[Javascript] onLoad error

Peter Brunone peter at brunone.com
Wed Jun 6 09:28:03 CDT 2001


    window.document.form1.select1.options[selectedIndex].value is basically
saying "the option at the index of the value of the *variable* named
selectedIndex".  You have not defined a variable named selectedIndex.
    The proper syntax for this would be




----- Original Message -----
From: "Daniel Newman" <daniel.newman at bis-web.net>
To: <javascript at LaTech.edu>
Sent: Wednesday, June 06, 2001 3:57 AM
Subject: [Javascript] onLoad error

> 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
> 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:
> ue);">
> I'm assuming that the onLoad will only execute once the page has loaded,
> 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
> 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
> 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.
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> http://www.LaTech.edu/mailman/listinfo/javascript

More information about the Javascript mailing list