|
-
Jan 26th, 2004, 09:16 AM
#1
Thread Starter
Addicted Member
JavaScript: (Why IE Sucks)
Consider the following code:
Code:
<html>
<head>
<title>Foo</title>
</head>
<body>
<select id="mySelect">
</select>
<script type="text/javascript">
myNewOption = document.createElement("option");
myNewOption.text = "foo";
myNewOption.value = 1;
document.getElementById("mySelect").add(myNewOption);
</script>
</body>
</html>
The following works in IE 6 on Windows 2000, but not in Mozilla 1.4 on Windows XP. Mozilla's complaint is that an arguement is missing from .add(). Yes, I admit that is true, but there is no element that I want the new one added before. What do I do?
Update: I've tried null as the second arguement. It works in Mozilla, but now breaks in IE. I suspect that this is the correct way, but I agree with MS, this arguement should be optional. I don't agree with MS that they shouldn't support the standard, though. I'm still looking for a common answer.
Last edited by Travis G; Jan 26th, 2004 at 03:30 PM.
Travis, Kung Foo Journeyman
Web Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.5 Guide and Reference
Perl: Documentation, Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
OSS: Mozilla, MySQL (Manual)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|