|
Q713 How do I make two dropdown menus, where the result of the selection of both dropdown menus will be shown in a text field?
irt.org | Knowledge Base | JavaScript | Form 6 | Q713 [ previous next ]
Q713 How do I make two dropdown menus, where the result of the selection of both dropdown menus will be shown in a text field?
Try:
<SCRIPT LANGUAGE="JavaScript"><!--
function updateTextField() {
document.form3.result.value =
document.form1.select1.options[document.form1.select1.selectedIndex].value + ' ' +
document.form2.select2.options[document.form2.select2.selectedIndex].value
}
//--></SCRIPT>
<FORM NAME="form1">
<SELECT NAME="select1" onChange="updateTextField()">
<OPTION VALUE="0">Zero
<OPTION VALUE="1">One
<OPTION VALUE="2">Two
<OPTION VALUE="3">Three
<OPTION VALUE="4">Four
<OPTION VALUE="5">Five
<OPTION VALUE="6">Six
</SELECT>
</FORM>
<FORM NAME="form2">
<SELECT NAME="select2" onChange="updateTextField()">
<OPTION VALUE="Zero">0
<OPTION VALUE="One">1
<OPTION VALUE="Two">2
<OPTION VALUE="Three">3
<OPTION VALUE="Four">4
<OPTION VALUE="Five">5
<OPTION VALUE="Six">6
</SELECT>
</FORM>
<FORM NAME="form3">
<INPUT TYPE="TEXT" NAME="result">
</FORM>
|
Feedback on 'Q713 How do I make two dropdown menus, where the result of the selection of both dropdown menus will be shown in a text field?'
|
|
Copyright © 1996-2008 irt.org, All Rights Reserved.