Wednesday, September 19, 2012

Sample JavaScript Code to Display/Hide the Table


<!--          Sample JavaScript program to Display/Hide Table         -->

<html>
<head>
<title>TableDisplayOnOff</title>
<script>
function load()
{
        var t = document.getElementById("tab");
        t.style.visibility="visible";
}

function load2()
{
        var t = document.getElementById("tab");
        t.style.visibility="hidden";
}
</script>
</head>
<body bgcolor=white>
<br><br><br><br><br><h3 align="center" style="font-family:arial;font-weight:BOLD;font-size:16px"> <u>Table</u></h3>
<form name ="frm">
<table id="tab" style="visibility:hidden">
<tr>
<th>RAGHUPATI</th><th></th><th>RAGHAVA</th><th></th><th>RAJA</th><th></th><th>RAM</th>
</tr>
</table>
<input type="button" name="hai" value="Display" onclick="load()">
<input type="button" name="hai" value="Hide" onclick="load2()">
</form>
</body>
</html>


---------------------------------------------------------------------------------------------------


<!--   Example:    Table Display/Hidden         -->
<html>
<head>
<title>Sample Program</title>
<script>
function load()
{
        var t = document.getElementById("tab");
        t.style.visibility="visible";
}
</script>
</head>
<body bgcolor=white>
<br><br><br><br><br><h3 align="center" style="font-family:arial;font-weight:BOLD;font-size:16px"> <u>TaskList</u></h3>
<form name ="frm">
<table id="tab" style="visibility:hidden">
<tr>
<th>name</th><th>address</th>
</tr>
</table>
<input type="button" name="hai" value="hai" onclick="load()">
</form>
</body>
</html>