How in Javascript or VB do I get second, third, etc of multiple selections in drop-down?

P

Phil McCharen

I cannot find mention of what function or object I can use to obtain the index into the drop-down box name for any selections other than the first one, if multiple selection is allowed. Document.init1.objectname.selectedIndex gives the index of the first item selected, but where are the others found?
 
K

Kevin Spencer

Hi Phil,

Just loop through the options array of the select object, and check the
"selected" property of each one. If it is true, it's selected. Example:

for (var i = 0; i < MySelect.options.length; i++)
{
if (MySelect.options.selected)
alert("Found one!");
}

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

Phil McCharen said:
I cannot find mention of what function or object I can use to obtain the
index into the drop-down box name for any selections other than the first
one, if multiple selection is allowed.
Document.init1.objectname.selectedIndex gives the index of the first item
selected, but where are the others found?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top