PDA

View Full Version : slectedIndex Problem


masmart
03-06-2003, 11:56 AM
I'm using two drop down menus, the I need to grab the text from the second menu, using:

<a href="javascript:jump(window.document.form_1.pullDown_2.options[selectedIndex].text);"><img></a>

but an error occurs saying selectedIndex is not defined!!! any ideas?

the same javascript works for my first drop down menu (but it's not in a <a href> thing.

Cheers

Mike

mordred
03-06-2003, 02:32 PM
selectedIndex is a property of a select list object, not of the link itself. Try

jump(window.document.form_1.pullDown_2.options[document.form_1.pullDown_2.options.selectedIndex].text);

masmart
03-06-2003, 02:33 PM
Hi thanks for the help, I did eventually realise that and it works.

Thanks A Lot.

Mike