hiding and unhiding <DIV>

windows

Guest
i'm trying to make it so i can hide and unhide a <DIV> tag.. i remember doing this before, but i moved, and some of my code is not available to me right now..<br />
<br />
i want to make some text clickable to make the <DIV> appear, but when clicked again, will make the <DIV> disappear, or hidden.<br />
<br />
if my div tag looks like this:<br />
<DIV NAME="quicknews" STYLE="visibility:hidden;overflow:auto;"><br />
<br />
what would my command be to make my text clickable to hide and unhide the <DIV>???<!--content--><script><br />
bla = 0<br />
<br />
function show() {<br />
if (bla == 1){<br />
div1.style.visibility='hidden';<br />
bla = 0;<br />
}<br />
else<br />
{<br />
bla = 1;<br />
div1.style.visibility='visible'<br />
}<br />
}<br />
</script><br />
<br />
<br />
<br />
<p onclick="show()">hide/unhide</p><br />
<div id="div1" name="div1" style="visibility:hidden">sometext</div></script><br />
<br />
used <p> now, but you can also use <a> or anything else<!--content--><script language="javascript"><br />
var DIVTAG = false;<br />
if (document.all){ <br />
DIVTAG = document.all["quicknews"];<br />
styleObj = ".style";<br />
showIt = "visible";<br />
hideIt = "hidden";<br />
<br />
} elseif (document.getElementById){<br />
DIVTAG = document.getElementById("quicknews");<br />
styleObj = ".style";<br />
showIt = "visible";<br />
hideIt = "hidden";<br />
<br />
} else if (document.layers){<br />
DIVTAG = document.layers("quicknews");<br />
styleObj = "";<br />
showIt = "show";<br />
hideIt = "hide";<br />
<br />
}<br />
</script><br />
<br />
<br />
<br />
<a href=http://www.htmlforums.com/archive/index.php/"javascript: if (DIVTAG){ eval(DIVTAG+styleObj+'.visibility = '+showIt) }">Show it</a><br />
<br />
<DIV NAME="quicknews" STYLE="position: relative; visibility:hidden;overflow:auto;" onclick="eval(DIVTAG+styleObj+'.visibility = '+hideIt)">Here</DIV><!--content-->
 
Back
Top