Click to See Complete Forum and Search --> : hide a layer when the mouse clicks a button


andrew1234
07-25-2003, 01:52 AM
Hi

I'm trying to hide a layer when the mouse clicks a button
and for some reason this does not work.

Any ideas???




<a href="#" onClick="document.getElementById('fred').visibility='hidden'">home</a>


<div id='fred' style='position:absolute; left:439px; top:90px; width:79px; height:43px; z-index:7; background-color: #990000; layer-background-color: #990000; border: 1px none #000000; visibility: visible;'></div>

thanks

Andrew

xataku_nakusute
07-25-2003, 05:16 AM
<script type="text/javascript">
function hide(txt)
{
obj = document.getElementbyId(txt);
obj.style.display="none" ? obj.style.display="block" : obj.style.display="none"; //{
}
}
</script>
<a href="#" onClick="hide('fred'); return false;">home</a>


<div id='fred' style='position:absolute; left:439px; top:90px; width:79px; height:43px; z-index:7; background-color: #990000; layer-background-color: #990000; border: 1px none #000000; display: none'></div>

pyro
07-25-2003, 07:23 AM
Which, of course, I originally gave at http://forums.webdeveloper.com/showthread.php?s=&threadid=13410#post71636...