> I have this form in test.jsp [...]
Instead of constantly posting untestable fragments of code, post a URL
to a (semi-)workable page that can be examined properly.
> <body onload="createFirstMenu('sel1');">
If this is for the Web, you should probably give this endeavor up:
constructing forms in this way is not a good way to author for a public
audience.
Richard Cornford has a method for producing dependent SELECT elements
without server-side support.
<URL:http://www.litotes.demon.co.uk/example_scripts/dependent_select.html>
Of course, if you have server-side support (and you do), then you should
just use that instead. Granted, it requires round trips to the server,
but at least it's reliable and doesn't force the user to download
options they may never need to select.
[Musing]
It would be nice if OPTGROUP elements could be nested. That would
produce a much nicer scriptable structure, and possibly help with
usability, too.
[/Musing]
> <select [...] onchange="createSecondMenu('sel1','sel2', 'sel3');">
> </select>
SELECT elements are required to have at least one OPTION element.
[snip]
> //s[0] = document.getElementById(arguments[0]); // s[0] contains the
> first
Stop using the getElementById method to access form controls. Use the
forms and elements collections instead.
[snip]
> How can s[0], s[1] and s[2] contain the selected index from the right
> drop/down menus when they don't contain a SELECT object???
They don't. Common sense should tell you that. The script will (and
does) error out.
Mike

Signature
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.