Sean Davison Sean Davison - 4 months ago 13
HTML Question

Need help using an HTML select box on IE8

I used the following HTML code to create a simple drop down menu. (Actully got it from this site by doing a search).

But the issue I'm having is the submit ("Go!") button works in every other browser but IE 8-9. Even works on IE 10 on a Windos Phone. CAn somebody PLEASE tell me what needs to be changed to get it working?

<form name="Game Results">
<select name="ddmenu_name" id="ddmenu_name" style="width: 40% !important;">
<option value="" selected>Select Game</option>
<option value="">Week 1</option>
<option value="">Week 2</option>
<option value="">Week 3</option>
<option value="">Week 4</option>
<option value="">Week 5</option>
<option value="">Week 6</option>
<option value="">Week 7</option>
<option value="">Week 8</option>
<option value="">Week 9</option>
<option value="">Week 10</option>
<option value="">Las Vegas</option>
<input type="button" name="Submit" value="Go!" onClick=",'newtab'+ddmenu_name.value)">


Being able to refer to an id directly in script was an old IE hack that is not standard, you should use document.getElementById instead.


<input type="button" name="Submit" value="Go!" onClick=",'newtab'+ddmenu_name.value)">


<input type="button" name="Submit" value="Go!" onClick="'ddmenu_name').value,'newtab')">

Also, IE (at least IE8) doesn't support an equal sign in a window name (this will result in a script error), so you'll have to find something safer to use - such as the index of the selected value:

<input type="button" name="Submit" value="Go!" onClick="'ddmenu_name').value, 'NewTab_' + document.getElementById('ddmenu_name').selectedIndex)">

I'm not sure if this is an IE thing or a standard browser thing.

Working Fiddle