[thelist] How to Show/Hide if an option is selected in a pull-down

Jono ox4dboy at comcast.net
Mon Aug 23 15:33:28 CDT 2004


What is the best way to add this type of functionality to a pull down list
item:

<!-- In the head -->

<script language="JavaScript" type="text/javascript">
function showHide (id)
{ 
 var style = document.getElementById(id).style
 if (style.visibility == "hidden")
  style.visibility = "visible";
 else  
  style.visibility = "hidden";
}
<!--


// -->
</script>

<!-- In the html on a Checkbox -->


<input name="add64bit" type="checkbox" id="add64bit" value="add64bit""
onClick="showHide('whatever');" />


<!-- In the html on <tr> that the checkbox shows/hides -->

<tr id="whatever" style="visibility: hidden;">Content to show/hide</tr>



I would like to use functionality similar to the above so that if the user
selects "Secondary" in the pull-down below, it will show the content in:

<tr id="whatever" style="visibility: hidden;">Content to show/hide</tr>


<select name="select3">
    <option>Choose one...</option>
    <option value="dns1">Primary</option>
    <option value="dns2">Secondary</option>
</select>


How can I make "<option value="dns2">Secondary</option>" once selected,
trigger the hidden <tr> to show itself?



More information about the thelist mailing list