View Full Version : Hiding tables
stewea99
09-06-2002, 10:35 AM
Is it possible to hide and show a table by clicking a tickbox?
Stewea
:)
requestcode
09-06-2002, 01:24 PM
You could place the table inside a div and set the visibility property to hidden. Then use the onClick event to perform a function to change the visibility property to visible.
MCookie
09-06-2002, 01:53 PM
Something like this:
<html>
<head>
<title></title>
<style type="text/css">
#tb {
position:absolute;
left:100px;
top:100px;
width:300px;
border:1px solid #000000;
}
</style>
<script type="text/javascript">
function show(id){
document.getElementById(id).style.visibility = "visible";
}
function hide(id){
document.getElementById(id).style.visibility = "hidden";
}
</script>
</head>
<body>
<form>
<p><input type="checkbox" onclick="show('tb')"> Show table<br>
<input type="checkbox" onclick="hide('tb')"> Hide it now</p>
</form>
<div id="tb"><table width="300" border="1" cellspacing="2" cellpadding="1">
<tr>
<td width="50%">Put stuff here..</td>
<td width="50%">More stuff..</td></tr></table></div>
</body>
</html>
stewea99
09-06-2002, 02:15 PM
Its close to what I'm looking for but it uses layers.
MCookie
09-06-2002, 07:17 PM
There are no layers in that code :)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.