Faqts : Computers : Programming : Languages : JavaScript : DHTML

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

28 of 45 people (62%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

How can i display/hide content in NN similar to toggling the display style in IE

Apr 21st, 2000 08:56
Marcus Young, Chris Reeves,


Layers have the visibility property:
layer_name.visibility
You can set it to show or hide.
document.layer_name.visibility='hide'
Here is a a bit of code that I've used.
<html>
<head>
<script language=javascript>
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
</script>
</head>
<body>
<a href="index.htm" onMouseOver="do_menu('show')" onMouseOut="do_menu
('hide')">Layer</a>
<script language=javascript>
if (isIE==true)
{
	document.write('<div id=layer1 
style="top:15;left:100;position:absolute;visibility:hidden">');
	document.write('<a href="index.htm">Home Page</a>');
	document.write('</div>');
}
else
{
	document.write('<layer id=layer1 name=layer1 top=15 left=100 
position=absolute visibility=hide">');
	document.write('<a href="index.htm">Home Page</a>');
	document.write('</layer>');
}
function do_layer(visible)
{
if (isIE==true)
{
	if (visible == 'show')
		visible = 'visible';
	if (visible == 'hide')
		visible = 'hidden';
	layer1.style.visibility = visible;
}
else
	document.layer1.visibility = visible;
}
</script>