-
asp select list
hiya was just wondering...
if i had a select list like...
<select name="list">
<option name="option1" value="1">option 1</option>
<option name="option2" value="2">option 2</option>
<option name="option3" value="3">option 3</option>
</select>
and a textbox like...
<input type="text" name="text">
was wondering how to change the value of the text box depending on what the user selects in the select list...like if the user selects option 1 the value of the text box will change to 1.
thanx in advance.
-
Code:
<select name="list" onchange="elements['text'].value = this.value">
<option name="option1" value="1">option 1</option>
<option name="option2" value="2">option 2</option>
<option name="option3" value="3">option 3</option>
</select>
<input type="text" name="text">
The elements['text'] part could also be replaced with document.getElementById or with an absolute path to the text input, but this one should be OK.
-
Code:
onchange="this.form.elements['text'].value = this.value;"
-