Hide or Show div

Example below shows or hides  div when a link is clicked.

<html>

<head>
<script language=”JavaScript”>
function ShowHide(divId)
{
if(document.getElementById(divId).style.display == ‘none’)
{
document.getElementById(divId).style.display=’block’;
}
else
{
document.getElementById(divId).style.display = ‘none’;
}
}
</script>
</head>

<body>

<a onclick =”javascript : ShowHide(‘HiddenDiv’)” href=”javascript:;” >Show or Hide</a>

<div id=”HiddenDiv” style=”DISPLAY: none” >
Stuffs to be hidden or shown goes here.

</div>
  
</body>
   
   
  

ajax JavaScript Tips and Tricks Websites