
show/hide an html table row
Try putting a div around it....you'll need to put it around the whole <tr>
to get the whole thing removed.
<form method="post" action="page2.asp" id="form1" name="form1">
<table>
<tr><td>Search:</td><td>
<select id="select1" name="select1">
<option Value="0">Select data</option>
<option Value="0">---------------------</option>
<option Value="1">Data 1</option>
<option Value="2">Data 2</option>
<option Value="3">Data 3</option>
</select></td></tr>
<tr><td>First Name:</td><td><INPUT type="text" id=text1
name="FName"></td></tr>
<tr><td>Last Name:</td><td><INPUT type="text" id=text2
name="LName"></td></tr>
<div id="mydiv"><tr><td>SSN:</td><td><INPUT type="text" id=text2
name="SSN"></td></tr></div>
</form>
<script language=vbscript>
sub select1_onchange()
if document.form1.select1.value = 1 then
document.mydiv.style.display = "none"
end if
end sub
</script>
Quote:
> Is there a way to hide/show a row in a table when a user selects an item
> from an option list? For instance, I know how to hide a textbox using the
> style.display property of the textbox, but that does not hide the text
that
> I have to the left of the textbox. Here's what I've got:
> <form method="post" action="page2.asp" id="form1" name="form1">
> <table>
> <tr><td>Search:</td><td>
> <select id="select1" name="select1">
> <option Value="0">Select data</option>
> <option Value="0">---------------------</option>
> <option Value="1">Data 1</option>
> <option Value="2">Data 2</option>
> <option Value="3">Data 3</option>
> </select></td></tr>
> <tr><td>First Name:</td><td><INPUT type="text" id=text1
> name="FName"></td></tr>
> <tr><td>Last Name:</td><td><INPUT type="text" id=text2
> name="LName"></td></tr>
> <tr><td>SSN:</td><td><INPUT type="text" id=text2 name="SSN"></td></tr>
> </form>
> <script language=vbscript>
> sub select1_onchange()
> if document.form1.select1.value = 1 then
> document.form1.ssn.style.display = "none"
> end if
> end sub
> </script>
> This will not remove the label "SSN:" from my form. Is there a way to do
> this? Thanks
> mike