hiding unhiding <div

C

chris

i found this script (full test page) on a forum and it was supposed to work
in netscape 4+ and ie - it works fine in IE but wont work in netscape

can anyone shed any lite on this

thanks
-------------------------------------
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--//
var layer_id;
function popUp(layer_id) {
if (document.all){
document.all[layer_id].style.visibility="visible"
}
else
if(document.layers){
document.layers[layer_id].visibility="show"
}
}
function hide(layer_id){
if (document.all){
document.all[layer_id].style.visibility="hidden"
}
else
if(document.layers){
document.layers[layer_id].visibility="hide"
}
}
//-->
</script>

<style>
..layer_1 { POSITION: absolute; VISIBILITY: hidden; TOP: 37px; LEFT: 100px;
padding: 5px 10px 5px 10px; }
..layer_2 { POSITION: absolute; VISIBILITY: hidden; TOP: 37px; LEFT: 100px;
padding: 5px 10px 5px 10px; }
</style>

</head>
<body bgcolor="#FFFFFF">
<a href="#" onMouseOver="popUp('la_1')"
onMouseOut="hide('la_1')">testlayer_1</a>
<a href="#" onMouseOver="popUp('la_2')"
onMouseOut="hide('la_2')">testlayer_2</a>

<div id="la_2" class="layer_2">
<layer name="la_2">
<table><tr><td>this is layer 2<td></tr></table>
</layer>
</div>


<div id="la_1" class="layer_1">
<table><tr><td>this is layer 1<td></tr></table>
</div>

</body>
</html>
 
C

chris

i just tried it in opera 7.54 and it works fine

its just netscape 7.1 it doesnt work in
 
K

Kris

"chris" <[email protected]> said:
i found this script (full test page) on a forum and it was supposed to work
in netscape 4+ and ie - it works fine in IE but wont work in netscape

Don't post listings, post a URL to a working example. In your replies,
don't toppost and snip the post your are replying to.
 
J

Jeffrey Silverman

i just tried it in opera 7.54 and it works fine

its just netscape 7.1 it doesnt work in

chris said:
i found this script (full test page) on a forum and it was supposed to work
in netscape 4+ and ie - it works fine in IE but wont work in netscape

can anyone shed any lite on this

thanks
-------------------------------------
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--//
var layer_id;
function popUp(layer_id) {
if (document.all){
document.all[layer_id].style.visibility="visible"
}
else
if(document.layers){
document.layers[layer_id].visibility="show"
}
}
function hide(layer_id){
if (document.all){
document.all[layer_id].style.visibility="hidden"
}
else
if(document.layers){
document.layers[layer_id].visibility="hide"
}
}
//-->
</script>

<style>
<snip!>

My answer may be technically wrong, but it is pretty close to correct.

Netscape6.x/7.x/Mozilla 1.x does not have either document.all OR
document.layers! (document.all is MSIE only; document.layers is Netscape
4.x only)

Use document.getElementById() instead. This is more W3C/DOM correct.

later...
 
R

Randy Webb

Jeffrey Silverman wrote:

<snip!>

My answer may be technically wrong, but it is pretty close to correct.

Netscape6.x/7.x/Mozilla 1.x does not have either document.all OR
document.layers! (document.all is MSIE only; document.layers is Netscape
4.x only)

Very very close, with one or two exceptions. document.all is not an MSIE
only thing. Opera has it, and one other browser has it (I dont recall
the name of it, it has both document.layers and document.all).

Also, Opera (in NN4 spoof mode) supports document.layers. See above for
document.all and document.layers.
 
J

Jeffrey Silverman

Very very close, with one or two exceptions. document.all is not an MSIE
only thing. Opera has it, and one other browser has it (I dont recall
the name of it, it has both document.layers and document.all).

Also, Opera (in NN4 spoof mode) supports document.layers. See above for
document.all and document.layers.


Wow! Opera is better than I thought. And I have always thought it was
pretty good.

But why would anyone want to spoof the crap that is NN4?
 
R

Randy Webb

Jeffrey said:
Wow! Opera is better than I thought. And I have always thought it was
pretty good.

But why would anyone want to spoof the crap that is NN4?

I guess for the same reason they spoof the crap that is IE?

I think NN4 spoofing was put in way back when NN4 was still around, and
its left in for legacy's sake. You would have to ask in an Opera group
to be sure though.

Follow-up: set to comp.lang.javascript and the invalid
alt.comp.lang.javascript removed.
 
T

Toby Inkster

Randy said:
Also, Opera (in NN4 spoof mode) supports document.layers. See above for
document.all and document.layers.

No, Opera doesn't support document.layers. It does however support the
non-standard document.all, but IIRC only in IE-spoofing mode.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,277
Latest member
VytoKetoReview

Latest Threads

Top