Hide and Show in Java Scrpit
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<script language="JavaScript">
function ShowHide(divId)
{
for(var i = 1; i < 5; i++)
{
if(i == divId)
{
document.getElementById(parseInt(i)).style.display='block';
}
else
{
document.getElementById(parseInt(i)).style.display='none';
}
}
}
</script>
<body>
<a onclick ="javascript:ShowHide(1)" href="javascript:;" >Show/Hide</a> </br></br>
<a onclick ="javascript:ShowHide(2)" href="javascript:;" >Show/Hide</a> </br></br>
<a onclick ="javascript:ShowHide(3)" href="javascript:;" >Show/Hide</a> </br></br>
<a onclick ="javascript:ShowHide(4)" href="javascript:;" >Show/Hide</a> </br></br>
<div id="1" style="display:none">
<table width="200" border="1" align="center" value="11">
<tr>
<td>1</td>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</div>
<div id="2" style="display:none">
<table width="200" border="1" align="center">
<tr>
<td>2</td>
<td>2</td>
<td>2</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</div>
<div id="3" style="display:none">
<table width="200" border="1" align="center">
<tr>
<td>3</td>
<td>3</td>
<td>3</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</div>
<div id="4"style="display:none" >
<table width="200" border="1" align="center">
<tr>
<td>4</td>
<td>4</td>
<td>4</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</div>
</body>
</html>
With Thanks & Regards,
Rajesh S
Comments
Post a Comment