S
Steven Post
Hi all,
I've got a situation where I have a given string and I need to find
which option in a select object has a value matching this string. I know
I could do it by iterating through all of the options and comparing my
string to the value of each, but what I am wondering is...
Is there anyway to access the values of options in a select object as
though they were keys in an associative array, something like:
myForm.mySelect.myOption['such-and-such'].index -- returns the index of
such-and such
I know there are a zillion reasons why this particular example doesn't
work, but is there any way to do this without iterating through the
array?
Many thanks,
sp
I've got a situation where I have a given string and I need to find
which option in a select object has a value matching this string. I know
I could do it by iterating through all of the options and comparing my
string to the value of each, but what I am wondering is...
Is there anyway to access the values of options in a select object as
though they were keys in an associative array, something like:
myForm.mySelect.myOption['such-and-such'].index -- returns the index of
such-and such
I know there are a zillion reasons why this particular example doesn't
work, but is there any way to do this without iterating through the
array?
Many thanks,
sp