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.