Select Lists Choice UnHides

[Total: 0    Average: 0/5]

Form textbox hides until the select list #1 is choosen.

Head Code:

<style>
.t1 {visibility: hidden;}
.t2 {visibility: visible;}
</style>
<script>
function sel()
{
  var _f=document.f1;
  var _s=_f.s1;
  var _i=_s.selectedIndex;
  if(_i==1)
    document.getElementById("text1").className="t2";
  else
    document.getElementById("text1").className="t1";
}
</script>

Body Code:

<form name=f1>
<select name=s1 onchange="sel()">
<option value="0">Select Item 1</option>
<option value="1">Item 1</option>
<option value="2">Item 2</option>
<option value="3">Item 3</option>
</select>
<HR>
<input id="text1" class=t1 value="I am hidden until you select Item 1">
<HR>
</form>

Times Viewed: 5

Leave a Reply

Your email address will not be published. Required fields are marked *