Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VERY URGENT: listbox item is selected?!

Status
Not open for further replies.

fmsousa

IS-IT--Management
Nov 24, 2000
28
PT
Hi,

I have 4 items in a listbox.
I would like to know if 1 of this 4 items is selected.

How can i do this.

Please it's very urgent.

Thanks in advance.
 
when you say a listbox do you mean a 'select' tag.

if so document.<formname>.<selectname>.value can be used to get the value of the selected option.

(where <forname> and <selectname> are the names of the form and select resp.)

think this should be null if none selected yet.

or
document.<formname>.<selectname>.selectedIndex returns the index of the selected option (ie. its position in the list)

document.<formname>.<selectname>.option[<index>].value can then be used to get the value of any given option (eg. the one you have just got from selectedIndex)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top