Hide table & Lock/Enable links

[Total: 0    Average: 0/5]

This shows how to have a table in a div that is hidden and can be made visible again.

Body Code:

<script>
var d=document.layers?"layer":"div";
document.write('<'+d+' name=d1 id=d1>');
document.write('<table border=1><tr><td>r1c1</td><td>r1c2</td></tr><tr><td>r2c1</td><td>r2c2</td></tr></table>');
document.write('</'+d+'>');
var _OK = false; // disable on page load
function en() {_OK=true;}
function de() {_OK=false;}
var _s = document.all?document.all.d1.style:document.d1;
function hi() {if(_OK)document.all?_s.visibility="hidden":_s.hidden=true;}
function sh() {if(_OK)document.all?_s.visibility="visible":_s.hidden=false;}
</script>
<BR><BR><BR><BR><BR><BR><BR><BR>
<HR>
[<a href="javascript:en()">enable</a> | <a href="javascript:de()">dis-able</a>]<BR>
[<a href="javascript:hi()">hide div</a> | <a href="javascript:sh()">show div</a>]

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *