Tested in Chrome 20, FF 13, IE 9, Safari 5.1.7.
Can anyone tell me why the following code works in Chrome, Firefox and IE, but not in Safari?
<select id="mySelectBox" onChange="window.open(options[selectedIndex].value);">
<option value="" selected="selected" >Choose a search engine.</option>
<option value="http://www.google.com" >Google</option>
<option value="http://www.bing.com" >Bing</option>
<option value="http://www.yahoo.com" >Yahoo</option>
</select>
My feeling is that Safari is doing the right thing. I shouldn't be able to reference the options property and selectedIndex property without using the this keyword or the more verbose document.getElementById('mySelectBox').
What's going on?
Thanks!
If you have Safari's "Block Pop-up Windows" setting checked that will stop this from working.