Dookster Posted April 25, 2007 Share Posted April 25, 2007 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 Quote Link to comment Share on other sites More sharing options...
fenway Posted April 25, 2007 Share Posted April 25, 2007 Is window.attachEvent cross-browser? Quote Link to comment Share on other sites More sharing options...
mainewoods Posted April 29, 2007 Share Posted April 29, 2007 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; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.