Re: Can't get selectedIndex property for listbox

Giganews Newsgroups
Subject: Re: Can't get selectedIndex property for listbox
Posted by:  Lee (
Date: 10 Jul 2003

Russell said:
>Posting again, since my first attempt never appeared:
>In the onClick method of a listbox, I am attempting to retrieve the
>selectedIndex property.  The listbox is set up to allow multiple selections.
>Unfortunately, the property returns -1.  Clicking again returns the proper
>result.  Yet when I do the same thing on the same listbox after changing it
>to allow only one entry to be selected, it always returns the proper result
>on the first click.  This is a pain.  Is there any way to get the proper
>value during the onClick when the listbox is set to allow multiple entries?

That's like complaining that you are able to get the birthdate of
an individual, but you're not getting a value when you ask for the
birthdate of a household.

If more than one item can be selected, the concept of a selectedIndex
doesn't really make sense, does it?  You loop through the options to
see which have the "selected" attribute set to true.



In response to

Can't get selectedIndex property for listbox posted by Russell Campbell on Thu, 10 Jul 2003