View Full Version : How do make a table appear or disapear
Maestre
03-23-2007, 03:22 PM
:confused: Im a bit lost, im looking for a way to make 3 different tables appear and disapear when you click on a link, whats the code?!?!?!?
thanks in advance
Martin
thetestingsite
03-23-2007, 03:44 PM
Place this code between the head section of the page.
<script type="text/javascript">
function showHide(id) {
if (document.getElementById(id).style.display == "none") {
document.getElementById(id).style.display = '';
}
else {
document.getElementById(id).style.display = "none";
}
}
</script>
Then place this in the body of the page:
<a href="#" onclick="showHide('test1'); return false;">Hide Table 1</a>
<a href="#" onclick="showHide('test2'); return false;">Hide Table 2</a>
<a href="#" onclick="showHide('test3'); return false;">Hide Table 3</a>
<table id="test1" border="1">
<tr>
<td>This is table 1</td>
</tr>
</table>
<table id="test2" border="1">
<tr>
<td>This is table 2</td>
</tr>
</table>
<table id="test3" border="1">
<tr>
<td>This is table 3</td>
</tr>
</table>
Hope this helps.
Maestre
03-23-2007, 04:16 PM
Unfortunatly I pretty sure I fallowed these steps but its not work even we just the test copied directly, sorry about this bother, but I really appreciate the help
thetestingsite
03-23-2007, 04:46 PM
ok, I made some mistakes, and editted the above code. Should work now as I have tested it. Hope this helps.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.