[Javascript] onLoad error
Peter-Paul Koch
gassinaumasis at hotmail.com
Wed Jun 6 04:16:45 CDT 2001
>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?
That's because nothing is yet selected in the first pulldown so there is no
selectedIndex. I'm not sure how to solve it, maybe setting one option to
SELECTED will help. Or you can first set selectedIndex to a certain option
(document.form1.select1.selectedIndex=3) and then execute the function.
>This is my syntax:
>
><BODY
>onLoad="swapoptions(window.document.form1.select1.options[selectedIndex].val
>ue);">
ppk
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
More information about the Javascript
mailing list