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 gkittelson 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 1

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.
 
I'm not sure this will work but try it anyway.

document.all[tablex].style.visibility=visible

i think that may help but only in IE

hope this helps

starfishh :)
 
yep, it works -- here is a little more detail on how to name it and such --

<html>
<head>
<title>Hiding Tables</title>
</head>
<script language=javascript>
function takeAction(value){
document.all.theTable.style.visibility = value;
}
</script>
<body>
<table id=theTable border=1>
<tr><td>I'M A HIDER!</td></tr>
</table>
<input type=button value=HideIt onClick=&quot;takeAction('hidden');&quot;>
<input type=button value=ShowIt onClick=&quot;takeAction('visible');&quot;>

</body>
</html>

definitely IE only.

:)
Paul Prewett
 
This code works a treat for me...

Code:
<html>
<head>
<title>CWD Template</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<script language=&quot;JavaScript&quot;>
function showHide(visSetting, rdo)
{
	document.getElementById(&quot;tbly&quot;).style.visibility = visSetting;
}
</script>
</head>
<body>
<table id=&quot;tblx&quot; rows=2 cols=2 border=1>
<tr>
<td>
<table style=&quot;visibility: hidden;&quot; id=&quot;tbly&quot; rows=1 cols=1 border=1>
<tr>
<td>
This is hidden!
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<input type=radio id&quot;rdo1&quot; onClick=&quot;showHide('visible', this);&quot;>
<input type=radio id=&quot;rdo2&quot; onClick=&quot;showHide('hidden', this);&quot;>
</td>
</tr>
</table>
</body>
</html>
Klae

You're only as good as your last answer!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top