Put your content in a div and set the visibility to "hidden". For the link, call a function which checks the visibility and reverses it (hide if visible and show if hidden).
[HTML]<a href="#" onclick="showHideContent(); return false;">Show/Hide Content</a>
<div id="content" style="visibility: hidden">content appears here</div>[/HTML]
- function showHideContent () {
-
var content = document.getElementById("content");
-
if (content.style.visibility == "hidden") content.style.visibility = "visible";
-
else content.style.visibility = "hidden";
-
}
If you need to actually add and remove content from the page, use the display property instead.