Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

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?

You are here: irt.org | FAQ | JavaScript | Form | 6 | Q713 [ previous next ]

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?'

©2018 Martin Webb