<Select> - Finding the index based on the option value
This is what I am trying to do:
<Select name ="test">
document.form.test.options[getIndexof('us')].selected = true;
Coz I actually I want to do this:
var value = r.select; //reading value from database.
document.form.test.options[getIndexof(value)].selected = true;
So basically, I pass the value of an option and find out the index for that option and make that index the selectedindex.
Is there something already out there that can do it or do I have to write my own getIndxof(value)???
Any help is appreciated. Thank you