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?

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 example

Below is a list of items you have to be careful about

  • Form 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.

    copy and paste the code and try it.

    <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> 
    function showHideSelection() 
       if (document.form1.gor.checked) 
         if (navigator.appName=="Netscape") 
          document.layers['formdiv'].visibility = "show"; 
          document.all['formdiv'].style.visibility = "visible"; 
         if (navigator.appName=="Netscape") 
          document.layers['formdiv'].visibility = "hide"; 
          document.all['formdiv'].style.visibility = "hidden"; 
    <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>
  • 0 Comments  (click to add your comment)
    Comment and Contribute






    (Maximum characters: 1200). You have 1200 characters left.