basically I have a pre-select value, lets say "AK"
I want the pulldown to reflect the value chosen.
So if I use the value of "AL" the pulldown will say "Alaska"
I have a pulldown menu that looks like this below:
<script language="javascript">
<!--//
function FillOptionsOptions() {
document.theForm.country.selectedIndex = 2; // selects the 2nd value of the pulldown, this works
document.theForm.country.selectedIndex = "AK"; // should select the "CA" value of the pulldown, doesn't work
}
//-->
</script>
<body onload=FillOptions()>
<form name=theForm>
<select name=country>
<option value="AL">Alabama
<option value="AK">Alaska
<option value="AS">Am. Samoa
</select>
</body>
Could someone please help me on this one..?
I want the pulldown to reflect the value chosen.
So if I use the value of "AL" the pulldown will say "Alaska"
I have a pulldown menu that looks like this below:
<script language="javascript">
<!--//
function FillOptionsOptions() {
document.theForm.country.selectedIndex = 2; // selects the 2nd value of the pulldown, this works
document.theForm.country.selectedIndex = "AK"; // should select the "CA" value of the pulldown, doesn't work
}
//-->
</script>
<body onload=FillOptions()>
<form name=theForm>
<select name=country>
<option value="AL">Alabama
<option value="AK">Alaska
<option value="AS">Am. Samoa
</select>
</body>
Could someone please help me on this one..?