[thelist] Javascript - detecting which SELECT!

Peter-Paul Koch gassinaumasis at hotmail.com
Tue Dec 5 04:26:50 CST 2000


>I know that the actual element is found like this:
>
>	window.document.form_name.select_name.selectedIndex
>returns the array number, you can then type
>	window.document.form_name.select_name.options[that_number].text
>to find out what was actually selected
>
>All well and good, but if I have multiple select elements on the page, how
>do I detect "select_name" in the code above.

function go(box)
{
  something = box.options[box.selectedIndex].text;
  do some more stuff with something;
}

and call it by

<SELECT onChange="go(this)">

Now you pass the correct select box on to the function and your problems 
have been solved.

ppk

_____________________________________________________________________________________
Get more from the Web.  FREE MSN Explorer download : http://explorer.msn.com





More information about the thelist mailing list