Re: [JavaScript] Getting Option Index based on Option Value
by Ken Creason <webmaster(at)fcs.net>
|
Date: |
Wed, 22 Nov 2000 09:43:53 -0800 |
To: |
hwg-languages(at)hwg.org |
In-Reply-To: |
hotmail |
|
todo: View
Thread,
Original
|
|
Perfect, thanks!
_Ken
At 10:35 PM 11/21/00 -0600, you wrote:
>AFAIK, your gonna have to run through the list with a loop to grab these:
>
>function getIndex(menu, value){
> result = -1;
> index = 0;
> while(index < menu.length && result = -1)
> if(menu[index].value == value)
> result = index;
> else
> index++;
> return result;
>}
>
>hope this helps. - Cyanide_7
>
>>I am trying to get the index of an Option element
>>in a Select list based on its Value.
>>This was my first (unsuccessful) guess:
>>
>>document.forms[ 0 ].billingstate.options["CA"].index
>>
>>How do reference this? I can't seem to find an example
>>in the O'reilly rhino book.
>>
>>Any help: vastly appreciated.
>>_Ken Creason
>>webmaster(at)fcs.net
HWG: hwg-languages mailing list archives,
maintained by Webmasters @ IWA