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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with HTML table visibilities

Status
Not open for further replies.

secretsquirrel

Programmer
Mar 22, 2001
202
GB
Hi guys,

I've got a page containing table x within table y. Table x is hidden. The page also contains yes and no radio buttons.

All I need is for table x to appear when the yes radio button is clicked.

I thought it would be a simple case of:

window.[table x].style.visibility = 'visible';

for the yes button, and

window.[table x].style.visibility = 'hidden';

for the no button, but when I run the page I get the error:

window.[table x].style is not an object.

Do I need some kind of reference like:

window.[table y].[table x].style.visibility = 'visible';

This only needs to work in IE.

Thanks in advance.
 
Try This :

<html>
<head>
<title></title>
</head>
<script language=javascript>
function hide(x)
{
if ( x == 1 )
{
hideme.style.visibility = 'hidden'
}
if ( x == 2 )
{
hideme.style.visibility = 'visible'
}
}
</script>
<body>
<span id=hideme>
<table>
<tr><td>Hello</td></tr>
</table>
</span>

Hide Table? &nbsp;
<input type=radio name=radio value=1 onclick=hide(1)>Yes</input>
<input type=radio name=radio value=2 onclick=hide(2)>No</input>

</body>
</html>


It should work but didn't have time to test it. My apologies if it fails, but let me know anyway. DeltaFlyer ;-)

DeltaFlyer - The Only Programmer To Crash With [colo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top