View Full Version : Drop Down Menu

12-08-2010, 07:15 PM
Hi Could you help me please. I am trying to make this drop down menu work in Internet Explorer 7 by inserting the Javascript. I'm obviously doing something wrong. Please be gentle with me I'm a bit of a newcomer to this::D

HTML and Javascript included below.

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>

<script type="text/javascript">

sfHover = function() {
var sfEls = document.getElementById("nav").getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
this.className+=" sfhover";
sfEls[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
if (window.attachEvent) window.attachEvent("onload", sfHover);


<link href="dropdownmenu.css" rel="stylesheet" type="text/css" />

<ul class="nav">

<li><a href="/home/">Home </a></li>
<li><a href="/products/">Products </a>


<li><a href="/products/silverback/">Silverback </a></li>
<li><a href="/products/fontdeck/">Font Deck </a></li>



<li><a href="/services/">Services </a>


<li><a href="/services/design/">Design </a></li>
<li><a href="/services/development/">Development </a></li>
<li><a href="/services/ consultancy/">Consultancy </a></li>


<li><a href="/contact/">Contact Us </a></li>



Shaka Zorba
12-08-2010, 07:35 PM
Here is one problem ...


you dont have an element with the id = "nav"

12-08-2010, 08:18 PM
OK thank you for that. I will change the 'class' nav to id 'nav'.