26
rated 0 times
[
30]
[
4]
/ answers: 1 / hits: 95902
/ 13 Years ago, fri, april 15, 2011, 12:00:00
I have a dropdown menu and I cannot figure out how to make a javascript function select a drop down menu option. I have tested the output of the variables and they are all correct, but it still will not select the option when clicked. Here is the function and drop down menu.
Function
function formFill(a, b, c){
theform.from.value = a;
theform.to.value = b;
for(var i = 0;i < document.getElementById(stateSelect).length;i++){
if(document.getElementById(stateSelect).options[i].value == c ){
document.getElementById(stateSelect).selected = true;
}
}
}
Menu item
<select id=stateSelect name=stateSelect>
<option value=none>(None)</option>
<option value=AL>Alabama</option>
<option value=AK>Alaska</option>
More From » html