Snippet Name: Hide/Show div
Description: Toggles the display of a div (can also be used on a SPAN).
Comment: (none)
Language: JAVASCRIPT
Highlight Mode: JAVASCRIPT
Last Modified: March 01st, 2009
|
< s c ript type="text/javascript">
FUNCTION toggle_div(id) {
VAR diq = document.getElementById(id).style;
diq.display=(diq.display=="none") ? "" : "none";
}
</script>
<!-- Example usage -->
<a href="javascript:toggle_div('hideshow')">Hide/show</a>
<div id="hideshow">
<h1>Example text to hide or show</h1>
</div> |