J1C wrote:
If I only know the value of an option is a select list, is it possible
to programmatically select that option?
I would be returning the value from a server-side script ...
Loop through the options in the select. When you find one with the
required value, set its selected property to true.
function selectOpt( f, s, v ){
var opts = document.forms[f].elements[s].options;
var o, i = opts.length;
while ( ( o == opts[--i] ) ) {
if ( o.value == v ) {
o.selected = true;
return;
}
}
}
If it's a multiple select, drop the return.
--
Fred