[thelist] JS: onSubmit function seems to reset Select input?

James Aylard evolt at pixelwright.com
Mon Nov 17 10:07:13 CST 2003


Tab Alleman wrote:

>> Change the line to
>>
>> if (document.forms[f].WhatToDo.selectedIndex == 4)
>>
>> and it should work as expected
>
> Eep!  Thanks...now if only that would have triggered an "errors on
> page" alert, I might've figured it out too.  : )

    If you rewrite it as:

if (4 == document.forms[f].WhatToDo.selectedIndex)

    and if you accidentally leave off one of the "equal" signs, you'll get
an error (since you can't assign a value to a number). It's a good coding
habit to get into.

James Aylard



More information about the thelist mailing list