It shouldn't work in FF either, but FF is error correcting the code for you. In javascript only one unique id is allowed per page. The script has no way to know which element that this line:
Code:
var sMonth = document.getElementById('idMonthOption').value;
refers to.
So it is just a matter of FF skipping the error by simply picking the first one it finds, and IE barfing on the error. Either way, it is still an error and would need to be corrected.
If you remove the comments, you will see that FF always picks:
Code:
<option value="2006-26" id="idMonthOption" onclick="sel('Hello')" > 2006-26 </option>
when determining what:
Code:
var sMonth = document.getElementById('idMonthOption').value;
and:
Code:
idMonthOption.value
are, regardless of which one is clicked.
Bookmarks