CoderZone.org

Category: >> JavaScript >> Show/Hide Toggle Bookmark and Share

<< lastnext >>

Snippet Name: Show/Hide Toggle

Description: Shows or hides content with the click of a link.

Comment: (none)

Author: CoderZone
Language: JAVASCRIPT
Highlight Mode: JAVASCRIPT
Last Modified: February 28th, 2009

<s c r ipt language="javascript">
function toggleDiv(id)
{
   var div = document.getElementById(id);
   var current = div.style.display;
 
   if (current == 'none')
      div.style.display = 'block';
   else
      div.style.display = 'none';
 
}
</ s c ript>
 
<a href="javascript:toggleDiv('block');">Toggle Block</a>
 
<div id="block">This is my Block</div>
 
There haven't been any comments added for this snippet yet. You may add one if you like.  Add a comment 
© coderzone.org | users online: 6