> If I have a select with several options, one of which is "selected", how do
> I de-select the original selected option and set a different option as
> selected using javascript? Is it possible? I have successfully set the
> values of inputs before but never this.
you need to use the select and option objects with javascript and set the
default.
here is an example:
var myselect=document.getElementById("sample")
for (var i=0; i<myselect.options.length; i++){
if (myselect.options[i].selected==true){
alert("Selected Option's index: "+i)
break
}
}
myselect.selectedIndex = 3; // sets the selected index for the select object
--
thebigdog
_______________________________________________
UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net