I've a HTML code snippet like follows:
<form>
<select name="mySelect">
<option value="1">text_1</option>
<option value="2">text_2</option>
</select>
</form>
I found out that in Internet Explorer, Javascript below can work:
document.forms[0].mySelect.options(0).text
But in Firefox or Chrome, it can not work and reports such error message:
document.forms[0].mySelect.options is not a function
In my opinion, mySelect.options should be an array, thus must be accessed by mySelect.options[0]. I also checked the DOM api and found no options function available.
Does it mean in the IE javascript engine, all arrays can be treated as both a collection and a function? Any advice will be appreciated, thanks in advance!
document.forms[0].mySelect.options[0]...options[0].text