One of the items in my dropdown list is "Other". When the user clicks on it I want to open a new text box where user can enter the values. How do I do this?
Created May 7, 2012
Firat Tiryaki You have to use divs to hide and show a form element. Pay attention to Netscape HTML coding here. Below is a simple form element showing and hiding exampleForm element to be hidden, must be in another form (For Netscape).
This form must be in a div.
Remember that forms can not be nested.
Below is a list of items you have to be careful about
copy and paste the code and try it.
<html> <head> <title>FORM</title> <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> <!-- function showHideSelection() { if (document.form1.gor.checked) { if (navigator.appName=="Netscape") document.layers['formdiv'].visibility = "show"; else document.all['formdiv'].style.visibility = "visible"; } else { if (navigator.appName=="Netscape") document.layers['formdiv'].visibility = "hide"; else document.all['formdiv'].style.visibility = "hidden"; } } //--> </SCRIPT> </head> <body> <form name="form1"> <input type="checkbox" name="gor" onclick="showHideSelection();"> Show options
</form> <div id="formdiv" style="position:relative; visibility:hidden;"> <form name="form2"> <select name="secme"> <option>Seçiniz</option> <option value="Choice 1">Choice 1</option> <option value="Choice 2">Choice 2</option> <option value="Choice 3">Choice 3</option> <option value="Choice 4">Choice 4</option> </select> </form> </div> <form name="form3"> <input type="text" name="isim" size="20"> </form> </body> </html>