Hide and Show DIV

[Total: 0    Average: 0/5]

This uses the style property to hide and show a div when it is clicked.

Body Code:

<div style="cursor: hand" onClick="toggle(document.all.HideShow);">

To see what happen, CLICK HERE
</div>

<span style="color: blue" id=HideShow>
This will go away (Click again and it'll come back)
</span>
<br>

<script>
function toggle(e)
{
 if (e.style.display == "none" )
   {
     e.style.display = "";
   }
 else
   {
     e.style.display = "none";
   }
}
</script>

Times Viewed: 0

Leave a Reply

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