[thelist] Tip: Showing/Hiding Relative Layers in Netscape

jon steele jjsteele22 at yahoo.com
Wed Jul 11 10:17:04 CDT 2001


<tip type="Showing/Hiding Relative Layers in Netscape">
We all know that to hide a layer in Netscape 4.7+ we need to stick a
"position:absolute" in the style attribute of a div. But, there's
another way, which does not require absolute positioning. Netscape can
do a lot of things with JavaScript and it's <layer> tag. But the layer
tag is always absolute. BUT, if we put it in an <ilayer> tag, it makes
the <layer> tag relative and Netscape still has all the control. I'm
sure a lot of people are looking for something like this. You can also
use this technique to do another things with relative layers: change
bgcolor, change clipping, etc.  Something like this:
<HTML>
<HEAD>
<TITLE>Hiding Relative Layers in Netscape</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function hide(a,b,c){
	if(document.layers)
		document.layers[b].document.layers[c].visibility = 'hide'
	else if(document.getElementById) 
		document.getElementById(a).style.visibility = 'hidden'
	else if(document.all)
		document.all.a.style.visibility = 'hidden'
}

function show(a,b,c){
	if(document.layers)
		document.layers[b].document.layers[c].visibility = 'show'
	else if(document.getElementById)
		document.getElementById(a).style.visibility = 'visible'
	else if(document.all)
		document.all.a.style.visibility = 'visible'
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080">
<a href="#" onclick="hide('a','b','c')">Hide</a> <a href="#"
onclick="show('a','b','c')">Show</a>
<br><br><br>
<ilayer name="b">
	<layer name="c">	
		<div id="a">
			Hi, this is the layer within layer within layer!
		</div>
	</layer>
</ilayer>
</BODY>
</HTML>
</tip>

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/




More information about the thelist mailing list