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 Link to comment https://forums.phpfreaks.com/topic/48591-making-my-java-flyout-menu-work-with-firefox/ Share on other sites More sharing options...
fenway Posted April 25, 2007 Share Posted April 25, 2007 Is window.attachEvent cross-browser? Link to comment https://forums.phpfreaks.com/topic/48591-making-my-java-flyout-menu-work-with-firefox/#findComment-238569 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; Link to comment https://forums.phpfreaks.com/topic/48591-making-my-java-flyout-menu-work-with-firefox/#findComment-240761 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.