[Javascript] onLoad error

Daniel Newman daniel.newman at bis-web.net
Wed Jun 6 03:57:25 CDT 2001


Hi,

hope someone can help with this, as it's driving me crazy.

I have two HTML select boxes, with the second being populated by choices
appropriate to the first. I have this working fine, but I need to get the
second box filled by the first boxes selection when the page loads, or more
importantly, when someone returns to the page (back key).

I have an onload statement in the body tag, but I keep getting a
"selectedIndex is undefined" error?

This is my syntax:

<BODY
onLoad="swapoptions(window.document.form1.select1.options[selectedIndex].val
ue);">

I'm assuming that the onLoad will only execute once the page has loaded, but
is it trying to fire off this function before my select box has loaded?

My reason's for needing this, is that I have four main options which someone
can search under, plus they can refine the search by selecting one of the
sub options. But, If I have option 4 displaying in the first box, and
selections for option 1 in the second, if someone was to select something
from the sub-option, it wouldn't return anything, as option 4 and sub-option
1:5 doesn't exist.

If you need to see any more code, just let me know.

Thanks,

Daniel Newman.
Bis-Web Ltd.
Tel: 01993 880614
Fax: 01993 881625

****************************************************************************
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the
material from any computer.
****************************************************************************





More information about the Javascript mailing list