I just want to set the select box value using a button like this
<BUTTON onclick="document.forms[0].select1.value = 'a'">SET</Button>
...
<select name="select1" size="1">
<option>a
<option>b
<option>c
</select>
But I found when I click the button, the select box change to blank.
And when I change the form to this:
<select name="select1" size="1">
<option value="a">a
<option value="b">b
<option value="c">c
</select>
It works!
Could any body tell me why? and how to solve it
thanks
<BUTTON onclick="document.forms[0].select1.value = 'a'">SET</Button>
...
<select name="select1" size="1">
<option>a
<option>b
<option>c
</select>
But I found when I click the button, the select box change to blank.
And when I change the form to this:
<select name="select1" size="1">
<option value="a">a
<option value="b">b
<option value="c">c
</select>
It works!
Could any body tell me why? and how to solve it
thanks
Comment