Forum Moderators: not2easy

Message Too Old, No Replies

CSS Layers in Netscape 4.7

Getting visability:visible - visibility:hidden to work in NN 4.7

         

classicalmusic

10:07 am on Jul 25, 2003 (gmt 0)

10+ Year Member



Hi,

Many thanks for your help. I have succeeded in getting my script to work in Netscape 7.1 and Explorer.

I am new to JavaScript and am studying DHTML.

Is there an easy way I could get my CSS layer script to work in Netscape 4.7?

Regards,

Robin
New Zealand.

BlobFisk

10:10 am on Jul 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi classicalmusic,

How is your script currently working? As opposed to posting the full script (it hurts my eyes!), maybe a brief outline of the logic involved.

From that we can work towards a solution for NN4.x compatibility.

BTW, have you looked at the dHTML menu system in the JavaScript Jumpstart #3 [webmasterworld.com]? It's NN4.x compatible and might give you an idea of making your script the same...

classicalmusic

10:20 am on Jul 25, 2003 (gmt 0)

10+ Year Member



I forward you the JS functions of my script which I would like to learn to make compatible with NN 4.7:

Hope this is enough to show you what I am doing.

Many thanks,

Robin.
NZ

<script type="text/javascript">

function MouseOver_PullDown1()
{


if (document.getElementById)
{

document.getElementById('pulldown1').style.visibility='visible';
}

else if (document.all)
{
document.all['pulldown1'].style.visibility='visible';

}

}

function MouseOut_PullDown1()
{

if (document.getElementById)
{

document.getElementById('pulldown1').style.visibility='hidden';
}


if (document.all)
{
document.all['pulldown1'].style.visibility='hidden';
}

}
// -->
</script>

BlobFisk

10:23 am on Jul 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



At the moment you are handlin DOM1 complaint browsers (getElementById) and old IE (document.all). NN4.x uses document.layers in its document object model, and this is the array for any <div>'s on the page.

You will need to add another conditional statement to test for NN4.x.

HTH

classicalmusic

11:16 am on Jul 25, 2003 (gmt 0)

10+ Year Member



Many thanks for your reply.

Could you please give me an example how to do this. I do not know whether I should add another "if" or "else if" conditional statements. What JS method should I use for NN4?

I enclose some sample code for NN4, which I cannot fathom how to manipulate and incorporate into my own script.

Many thanks,

Robin
New Zealand.

<script language="JavaScript">
<!--

ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false

// Show/Hide functions for non-pointer layer/objects
function show(id) {
if (ns4) document.layers[id].visibility = "show"
else if (ie4) document.all[id].style.visibility = "visible"
}

function hide(id) {
if (ns4) document.layers[id].visibility = "hide"
else if (ie4) document.all[id].style.visibility = "hidden"
}

//-->
</SCRIPT>

BlobFisk

12:22 pm on Jul 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It would be an else if into your mouseover and mouseout pulldown functions.

classicalmusic

1:32 am on Jul 26, 2003 (gmt 0)

10+ Year Member



Hi,

I have tried several experiment using else if conditional statements to try to get the visibility:visible - visibility:hidden to be recognised in Netscape 4.7.

My variable nn4 appears to be working as my alert test shows “true1” and “true2” when I execute my script in NN 4.7 and “false1” - “false2” in Explorer and NN 7.1, as I would expect. So it certainly looks like I am on the right track.

It appears then, that my problem lies somewhere in the style sheet layers attributes within my functions.

Could you please give some suggestions as to what I should add to my script so that I can succeed in getting the visibility to work in NN 4.7 My script is presented below.

Many thanks,

Regards,

Robin
New Zealand.

<script type="text/javascript">

nn4 = (document.layers)? true:false //variable for Netscape Communicator 4.7

function MouseOver_PullDown1()
{


if (document.getElementById)
{

document.getElementById('pulldown1').style.visibility='visible';
}

else if (document.all)
{
document.all['pulldown1'].style.visibility='visible';

}
else if (nn4) //Netscape Communicator 4.7
{
document.pulldown1[nn4].visibility='visible';
}

}
alert(nn4 + '1')

function MouseOut_PullDown1()
{

if (document.getElementById)
{

document.getElementById('pulldown1').style.visibility='hidden';
}


else if (document.all)
{
document.all['pulldown1'].style.visibility='hidden';
}

else if (nn4) //Netscape Communicator 4.7
{
document.pulldown1[nn4].visibility='hidden';
}

}

alert(nn4 + '2')

// -->
</script>
<style type="text/css">
<!--
#menu {position:absolute; left:90px; top:40px; width:80px; border:1px red solid; z-index:2; background:#ff6600}
#pulldown1 {position:absolute;left:90px; top:70px; width:80px; border:1px red solid; z-index:1; background:#ffff33; visibility:hidden}
-->
</style>