Click to See Complete Forum and Search --> : onChange not working in IE


lxndr
06-07-2006, 09:14 PM
The following appears to work fine in Firefox but does nothing in IE. Can anyone tell me what I've done wrong ?

In document HEAD

<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
<!-- //
function go()
{
var destination;
box = document.forms[0].navi;
destination = box.options[box.selectedIndex].value;
if (destination) location.href = "view.php?status=s&uname="+destination;
}
// -->
</SCRIPT>


In main body of page:

<FORM>
<table align=right>
<tr>
<td>
<SELECT name="navi" onChange="go()">
<OPTION >Name1 </OPTION>
<OPTION >Name2 </OPTION>
<OPTION >Name3 </OPTION>
</SELECT>
</td>
</tr>
</table>
</FORM>


Thanks in advance for any help.

A1ien51
06-07-2006, 09:29 PM
Did you leave out the values? You probably need them unless you cahnge value to text in your JavaScript.

Eric

lxndr
06-07-2006, 09:37 PM
Did you leave out the values? You probably need them unless you cahnge value to text in your JavaScript.

Eric

Thanks, that fixed it. I was generating the HTML using PHP and had forgot the VALUE bit. I didn't spot it because I was assuming that I'd made a mess of the javascript and also because Firefox was working fine.