>This is a basic question... Can I find the index of a select box, 
>if I have the value or the text ???
>document.formName.optionName.options["C"].selected=true 
>-- This won't work!!
 
You need to loop through each option, checking to see it's value and then
checking it.

var s = document.formname.optionname;
for (var i=0; i<s.options.length; i++) {
  if (s.options[i].value=="C") {
   s.selected=true;
  }
}

Or, using functions at http://www.mattkruse.com/javascript/validations/ you
can do:

setInputValue(document.formname.optionname,"C");

Be careful - multiple options are allowed to have the same value!

Matt Kruse

Reply via email to