Something like this:
for(i=0; i<document.Form1.area1.options.length;i++)
{
if(document.Form1.area1.options[i].selected)
{
//do something with document.Form1.area1.options[i].value
}
}
http://msdn.microsoft.com/workshop/author/dhtml/reference/collections/
options.asp
---- Original Message ----
From: poo_007@h...
To: javascript@p...
Subject: RE: [javascript] listbox problem
Date: Fri, 11 May 2001 17:38:17 +0100
>hi
>
>i have a list box thro which multiple values can be selected. i want
>to pass
>the values selected from the listbox to a javascript function for
>further
>manipulation.
>
>below is a code snippet:
>
>Index = document.Form1.area1.length ;
> for (i=0 ; i < Index ; i++)
> {
> if (i==0)
> {
> strSend +=document.Form1.area1(i).value ;
> }
> else
> {
> strSend += "~" + document.Form1.area1(i).value ;
> }
> }
>
>
>when i tried to use it like the above, all the values of the listbox
>are
>included(even the unselected values are contained in the array of
>values of
>area1) rather than the selected values. how do i access the selected
>values
>alone?
>
>-lakshmanan
>
>_________________________________________________________________
>Get your FREE download of MSN Explorer at http://explorer.msn.com
>
>
>$subst('Email.Unsub')
>
>
Brian Matsik
President and Senior Consultant
OOCS
-----
Author: ?MCSD Fast Track: Solutions Architecture?, New Riders Press
Co-Author: ?Professional ADO 2.5 Programming?, Wrox Press
Co-Author: ?VBScript Programmer?s Reference?, Wrox Press
Co-Author: ?Professional Visual Interdev 6 Programming?, Wrox Press
Co-Author: ?Professional Access 2000 Programming?, Wrox Press
Co-Author: ?Beginning SQL?, Wrox Press