-
Anybody know how to hide a layer and display a layer in netscape?
I need to us the <div> tag instead of the <layer> tag.
I used document.all.layername.visibility="hidden" and it works in IE.
But when i use document.layers.layername.visibility="hidden", netscape give me no property error.
Anybody have any idea?
-
try this:
Code:
document.object2.visibility = 'hidden';
and the layer is defined thus:
Code:
<div ID="object2" STYLE="position:absolute;top:145;left:270">
</div>
-
This doesn't work in Netscape.
my Structure:
<body onload="hideLayer()">
<table>
<tr><td>
<div name=test id=test>
<table>
</table>
</div>
</td>
</tr>
</table>
</body>
function hideLayer() {
if (document.layers) {
document.test.visibility="hidden";
}
else if (document.all) {
document.all["test"].style.visibility="hidden";
}
}
IE is working, netscape is not. Anybody has a solution?
-
it seems that you DIV needs to have some style attibutes defined.
also, defining DIVs within a table id a bit er... unusual.
this works:
Code:
<HTML>
<HEAD>
<Script language=javascript>
function hideLayer()
{
if(document.layers)
{
document.obj1.visibility="hidden";
}
else if (document.all)
{
document.all["obj1"].style.visibility="hidden";
}
}
</script>
</HEAD>
<body onLoad="hideLayer()">
<div id='obj1' STYLE="position:absolute;top:145;left:270">
some text
</div>
</body>
</HTML>
-
You are right.
My problem is the table.
If i put the <div> as below:
<table>
<tr><td><table>
<div><tr><td><table><tr><td>testing</td></tr></table></td></tr></div>
</table></td></tr>
</table>
It works in IE but not netscape. If i put it opposite:
<table>
<tr><td>
<div>
<table>
<tr><td><table><tr><td>testing</td></tr></table></td></tr>
</table></div></td></tr>
</table>
It totally will not work.