Jump to content

Making my java flyout menu work with firefox


Dookster

Recommended Posts

I need this flyout menu to work with firefox it now only works with IE what am i doing wrong?

ill post the code bellow

 

<style type="text/css">

<!--

#nav, #nav ul {

padding: 0;

margin: 0;

list-style: none;

}

 

#nav li {

float: left;

width: 25px;

}

 

#nav ul {

position: absolute;

width: 25px;

left: -1000px;

background: #DFDFDF;

A:link {text-decoration: none}

A:visited {text-decoration: none}

A:active {text-decoration: none}

A:hover {text-decoration: underline; color: red;}

}

 

#nav li:hover ul, #nav li.ie_does_hover ul {

left: auto;

}

 

#nav a {

display: block;

}

-->

</style>

 

<script language="JavaScript">

sfHover = function() {

var sfEls = document.getElementById("nav").getElementsByTagName("LI");

for (var i=0; i<sfEls.length; i++) {

sfEls.onmouseover=function() {

this.className+=" ie_does_hover";

}

sfEls.onmouseout=function() {

this.className=this.className.replace(new RegExp(" ie_does_hover\\b"), "");

}

}

}

if (window.attachEvent) window.attachEvent("onload", sfHover);

</script>

 

i realy have no idea why it doesnt work.

with best regards

Dookster

Link to comment
Share on other sites

fenway is right, window.attachEvent only works with ie, ff uses:

obj.addEventListener( type, fn, false ); 

http://www.quirksmode.org/js/events_order.html

In one or both of those as well, the 'this' keyword will not be available.

Sad, but the older non standards method is more cross browser compatable:

window.onload = sfHover;

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.