Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select jscript 1

Status
Not open for further replies.

ghorr

Programmer
Sep 16, 2002
29
RO
could please anyone show me a simple example that does something like:
i have a select and depending on what i select i want to show or hide some textboxes ...
thnx
 
Code:
<head>
 <script language=javascipt>
  function showHide(objList){
   var text1 = document.myForm.txt1;
   var text2 = document.myForm.txt2;
   if(objList.options[objList.selectedIndex].value == &quot;0&quot;){
    text1.style.display = &quot;none&quot;;
    text2.style.display = &quot;block&quot;;
   }
   else{
    text1.style.display = &quot;block&quot;;
    text2.style.display = &quot;none&quot;;
   }
  }
 </script>
</head>
<body>
 <form name=&quot;myForm&quot; method=&quot;post&quot; action=&quot;sompage.asp&quot;>
  <select name=&quot;myList&quot; onchange=&quot;javascript:showHide(this)&quot;>
   <option value=&quot;0&quot;>Option 1</option>
   <option value=&quot;1&quot;>Option 2</option>
  </select>
  <input type=text name=&quot;txt1&quot;>
  <input type=text name=&quot;txt2&quot;>
 </form>
</body>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top