SlickAU Posted August 23, 2007 Share Posted August 23, 2007 Hey dudes, I am in the final stages of finishing this drop down menu I have made using mainly div tags, javascript and css... It looks absolutely perfect in Firefox, but when you open it up in IE, the dropdown function does not work properly and the css doesn't kick in properly. ??? Here is the code for the page: <div id='topnav'> <div id="navcontainer"> <div id="navbox" onmouseover="dropdown('1')" onmouseout="drophide()">Application <div id="navdrop" onmouseover="dropdown('1')" onmouseout="drophide()"> <a href="database/" class="menuitem">Database</a> </div> <div id="navdrop1" onmouseover="dropdown('1')" onmouseout="drophide()"> <a href="#" class="menuitem">Frame Editor</a> </div> </div> <div id="navbox" onmouseover="dropdown('2')" onmouseout="drophide()">Websites <div id="navdrop2" onmouseover="dropdown('yes')" onmouseout="drophide()"> <a href="?p=websites" class="menuitem">View</a> </div> </div> <div id="navbox"><a href="?p=media" class="menuitem">Media</a> </div> <div id="navbox"><a href="?p=contact" class="menuitem">Contact</a></div> </div> </div> and here is the CSS: #topnav { margin:0; padding:0; height:20px; width:100%; background-color:#87c8fb; z-index:1; } #navcontainer { margin-left:220px; float:left; z-index:1; position:relative; height:20px; } #navbox { width:120px; height:17px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold; text-align:center; color:#FFFFFF; padding-top:2px; float:left; text-decoration:none; } #navbox:hover { background-color:#666666; border-botcument.getElementById("navdrop1").style.visibility = "visible" } else if (number =="2") { document.getElementById("navdrop2").style.visibility = "visible"; } } function drophide() { document.getElementById("navdrop").style.visibility = "hidden" document.getElementById("navdrop1").style.visibility = "hidden" document.getElementById("navdrop2").style.visibility = "hidden" } </script> Any help would be much appreciated.... Thanks Quote Link to comment https://forums.phpfreaks.com/topic/66303-drop-down-menu-appears-different-in-ie-js-and-css-menu/ Share on other sites More sharing options...
php_tom Posted August 23, 2007 Share Posted August 23, 2007 #navbox:hover { background-color:#666666; border-botcument.getElementById("navdrop1").style.visibility = "visible" } else if (number =="2") { I don't understand what you're doing here... mixing CSS and JavaScript ? ? ? In IE this gives lots of errors... In FireFox, the CSS hover works, but the visibility of the menues is always on (no dropdown). I'd separate out the CSS from the JS... maybe that would fix your issue. Quote Link to comment https://forums.phpfreaks.com/topic/66303-drop-down-menu-appears-different-in-ie-js-and-css-menu/#findComment-331947 Share on other sites More sharing options...
SlickAU Posted August 24, 2007 Author Share Posted August 24, 2007 I don't understand what you're doing here... mixing CSS and JavaScript ? ? ? Woops this was a mistake i made on the post itself...the code is actually seperate... Here is the CCS Code: #topnav { margin:0; padding:0; height:20px; width:100%; background-color:#87c8fb; z-index:1; } #navcontainer { margin-left:220px; float:left; z-index:1; position:relative; height:20px; } #navbox { width:120px; height:17px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold; text-align:center; color:#FFFFFF; padding-top:2px; float:left; text-decoration:none; } #navbox:hover { background-color:#666666; border-bottom:1px solid #333333; border-top:1px solid #333333; color:#FFFFFF; } #navdrop { height:18px; width:120px; color:white; background-color:#87c8fb; padding-top:5px; margin-top:4px; visibility:hidden; } #navdrop:hover { color:#FFFFFF; background-color:#666666; } #navdrop1 { height:18px; width:120px; color:white; background-color:#87c8fb; padding-top:5px; border-bottom:1px solid #333333; visibility:hidden; } #navdrop1:hover { color:#FFFFFF; background-color:#666666; } #navdrop2 { height:18px; width:120px; color:white; background-color:#87c8fb; padding-top:5px; margin-top:4px; visibility:hidden; border-bottom:1px solid #333333; } #navdrop2:hover { color:#FFFFFF; background-color:#666666; } and here is the Javascript: <script language="javascript" type="text/javascript"> function dropdown(number) { if (number == "1") { document.getElementById("navdrop").style.visibility = "visible" document.getElementById("navdrop1").style.visibility = "visible" } else if (number =="2") { document.getElementById("navdrop2").style.visibility = "visible"; } } function drophide() { document.getElementById("navdrop").style.visibility = "hidden" document.getElementById("navdrop1").style.visibility = "hidden" document.getElementById("navdrop2").style.visibility = "hidden" } </script> Also here is the LIVE link for the page itself: http://www.theslick.com/portfolio/v2 Hope this clears it up a bit.. Thanks again, Slick Quote Link to comment https://forums.phpfreaks.com/topic/66303-drop-down-menu-appears-different-in-ie-js-and-css-menu/#findComment-332753 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.