View Full Version : hiding a table
ecnarongi
06-17-2003, 07:01 PM
how would I do this? I have tired this
<table id="tabname" style="visibility: hidden">
<tr><td></td></tr>
</table>
with a function that changes the visibilty, but it doesn't work. can anyone help me? all help is appreciated, thanks.
<script>
function vanish(){
if(document.getElementById("tabname").style.visibility=="visible"){
document.getElementById("tabname").style.visibility="hidden"
}
else{
document.getElementById("tabname").style.visibility="visible"
}
}
</script>
<table id="tabname" border="1" style="visibility:visible">
<tr><td>Your Table</td></tr>
</table>
<P><a href="#null" onclick="vanish()">Vanish</a>
Ben@WEBProp
06-17-2003, 07:28 PM
Does this work too?
<tr>
<td width="14%"></td>
And are you trying to hide the enite table and all contents or are you just trying to hide the table chrome borders?
I was wondering what the % sign does, but maybe that is what it does...
Anybody who has any insight to this is cool...
Anybody who doesn't have any insight to this is...cool aswell I guess...
Thanks!
-Ben
I was wondering what the % sign does, but maybe that is what it does...
% means percent, you can state a size in pixels or percentages so 14% of 250 would be 35 pixels
ecnarongi
06-17-2003, 08:53 PM
thanks fellas :thumbsup:
shlagish
06-18-2003, 01:21 AM
Carefull, I don't think visibility: hidden works in Netscape, I think Netscape uses visibility: hide, but I'm not sure
beetle
06-18-2003, 03:10 AM
Originally posted by shlagish
Carefull, I don't think visibility: hidden works in Netscape, I think Netscape uses visibility: hide, but I'm not sure That is true only for NS4.x and not NS6+
I suppose you could go
<SCRIPT language="JavaScript">
<!--
function vanish(){
if(document.getElementById){
if(document.getElementById("tabname").style.visibility=="visible"){
document.getElementById("tabname").style.visibility="hidden"
}
else{
document.getElementById("tabname").style.visibility="visible"
}
}
if(document.layers){
if(document.layers["tabname"].visibility == "show"){
document.layers["tabname"].visibility = "hide"
}
else{
document.layers["tabname"].visibility = "show"
}
}
}
// -->
</SCRIPT>
beetle
06-18-2003, 04:59 PM
Here's an abstracted interface I wrote for this a while back
Here. toggleVis() relies on showObj() and hideObj(), but showObj() and hideObj() can be run independently. All three rely on getNode()
function getNode( oId )
{
return ( document.layers ) ? document.layers[oId] : ( document.getElementById || document.all )( oId );
}
function toggleVis( oId )
{
var o = getNode( oId );
var vis = ( document.layers ) ? o.visibility : ( o.currentStyle ) ? o.currentStyle.visibility : o.style.visibility;
if ( vis == 'hidden' || vis == 'hide' )
showObj( o );
else
hideObj( o );
}
function hideObj( o )
{
if ( typeof o == "string" ) o = getNode( o );
if ( document.layers )
o.visibility = 'hide';
else
o.style.visibility = 'hidden';
}
function showObj( o )
{
if ( typeof o == "string" ) o = getNode( o );
if ( document.layers )
o.visibility = 'show';
else
o.style.visibility = 'visible';
}
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.