p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning JavaScript (http://p2p.wrox.com/forumdisplay.php?f=31)
-   -   Using div for menu in Netscape 6 (http://p2p.wrox.com/showthread.php?t=74)

chrisk June 4th, 2003 04:44 AM

Using div for menu in Netscape 6
 
I am using the following function to hide a menu which works fine in
everything except NN 6 - the function hides the div on rolling out of the
text in the layer not the whole div itself. I used some code (borrowed from your book) to get around the problem in IE but cannot find equivilent code
for NN 6. Can anyone help? Regards. Incidentally I am using a NN 4 style
layer nested within a div to provide a MouseOut event for NN 4 could this
have any effect?

function hideMenu()
{
if (document.all)
 {
 if (event.toElement != HomeMenu && HomeMenu.contains(event.toElement) ==
false)
  {
   document.all.HomeMenu.style.visibility="hidden";
  }
 }
else if (document.layers)
 {
 document.HomeMenu.visibility="hidden";
 }
else if (!document.all && document.getElementById)
 {
     document.getElementById("HomeMenu").style.visibili ty="hidden";
    }

}

PhilM July 20th, 2004 03:23 PM

I wouldn't put too much focus on document.all this is an IE4 method, which will still work in IE5 as it is backwards compatable.
For IE5, NS6 and all DOM compliant browsers the correct method is document.getElementById?1:0;.

Use: this.dom=document.getElementById?1:0; as your priority. IE5 & NS6.
Use: this.ns4=(document.layers && !this.dom)?1:0; as NS4.
And use: this.ie4=(document.all && !this.dom)?1:0; as IE4

Hope this helps!



All times are GMT -4. The time now is 07:51 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.