Entry
How can I turn a table on/off within a form with a simple checkbox?
Apr 7th, 2008 23:16
ha mo, Colin Fraser, David Boosamra,
There are two ways of doing this.
Firstly the hard way, which involves a lot of coding that can and often
does go wrong making a mess of the essential practice of making tables
dynamic. I do not recommend this way, it is a painful exercise and can
be soul destroying.
The other is simple, effective, create a layer, then with the table in
the layer show or hide the layer. I have used buttons here, but the same
principles will apply using a checkbox, (I just did not have the time or
will to write it all out for you. BTW, this is set up for Internet
Explorer, I am not sure what Netscape is doing with layers these days,
and unfortunately, I no longer use it at work, so everything is set for
IE these days.
<script>
function show(id) {
document.all[id].style.visibility = "visible"
}
function hide(id) {
document.all[id].style.visibility = "hidden"
}
</script>
<body>
<div id="div1" style="visibility:visible">
<table border=1>
<tr><td>Table</td><td>Hiding</td><td>and Showing</tr>
</table>
</div>
<form>
<input type="button" value = "Hide" onClick="hide('div1')">
<input type="button" value = "Show" onClick="show('div1')">
</form>
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com