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
Highlight Mode: JAVASCRIPT
Last Modified: February 28th, 2009

<s c r ipt language="javascript">
function toggleDiv(id)
   var div = document.getElementById(id);
   var current =;
   if (current == 'none') = 'block';
   else = '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 
© | users online: 10