You are here: irt.org | FAQ | JavaScript | Form | 11 | Q806 [ previous next ]
Try:
<SCRIPT LANGUAGE="JavaScript"><!-- function changeForm(what) { for (var i=0; i<what.options.length; i++) { if (what.options[i].selected) { if (document.all) document.all[what.options[i].value].style.visibility="visible"; else if (document.layers) document.layers[what.options[i].value].visibility = "visible"; } else { if (document.all) document.all[what.options[i].value].style.visibility="hidden"; else if (document.layers) document.layers[what.options[i].value].visibility = "hidden"; } } } //--></SCRIPT> <FORM> <SELECT NAME="selectList" onChange="changeForm(this.form.selectList)"> <OPTION VALUE="form1" SELECTED>Show Form 1 <OPTION VALUE="form2">Show Form 2 <OPTION VALUE="form3">Show Form 3 </SELECT> </FORM> <DIV STYLE="position: absolute"> </DIV> <DIV ID="form1" style="position: absolute; top: 100; left: 100; visibility: visible;"> <FORM> Form 1 - <INPUT TYPE="TEXT" NAME="myName1" VALUE="myValue1"> </FORM> </DIV> <DIV ID="form2" style="position: absolute; top: 100; left: 100; visibility: hidden;"> <FORM> Form 2 - <INPUT TYPE="TEXT" NAME="myName2" VALUE="myValue2"> </FORM> </DIV> <DIV ID="form3" style="position: absolute; top: 100; left: 100; visibility: hidden;"> <FORM> Form 3 - <INPUT TYPE="TEXT" NAME="myName3" VALUE="myValue3"> </FORM> </DIV>