Hi, i am being creating a drop down menu. But i getting trouble in that.
The sub menu that must be displayed when the link is hover is displayed although the link is not hover.
This is the script that i create , please help me for correcting the wrong script.
Thanks
The html scripts
<ul id="menu">
<li class="noDivider"><a href="home.html" title="Home">Home</a></li>
<li><a href="contact_information/about-us.html" rel="nofollow" title="About Us">About Us</a></li>
<li><a href="products/products.html" rel="nofollow, noindex" title="Products">Products</a></li>
<li>
<a href="/transformers" rel="nofollow, noindex" title="Catalog">Catalog</a>
<ul class="catalogNav">
<li><a href="transformers" rel="nofollow" title="Transformers">Transformers</a></li>
<li><a href="products/switch-panel.html" rel="nofollow" title="Switchgear">Switchgear</a></li>
<li><a href="products/switch-panel.html#panels" rel="nofollow" title="Circuit Breakers">Circuit Breakers</a></li>
<li><a href="products/qualty-con-un.html#power" rel="nofollow" title="UPS Systems">UPS Systems</a></li>
<li><a href="products/switch-panel.html#panels" rel="nofollow" title="Panelboards">Panelboards</a></li>
<li><a href=/power-line-conditioners" rel="nofollow" title="Power Line Conditioners">Power Line Conditioners</a></li>
<li><a href="products/qualty-con-un.html" rel="nofollow" title="Constant Voltage Power Conditioners">Constant Voltage Power Conditioners</a></li>
<li><a href="products/rect-phase.html#converters" rel="nofollow" title="Phase Converters">Phase Converters</a></li>
<li><a href="products/qualty-con-un.html#quality" rel="nofollow" title="Power Quality Equipment">Power Quality Equipment</a></li>
<li><a href="/transient-voltage-surge-suppressors" rel="nofollow" title="TVSS">TVSS</a></li>
<li><a href="/all-categories" rel="nofollow" title="Generators">Generators</a></li>
<li><a href="products/motors.html" rel="nofollow" title="Motors & Motor Control">Motors & Motor Control</a></li>
<li><a href="products/rect-phase.html" rel="nofollow" title="Rectifiers">Rectifiers</a></li>
<li><a href="products/switch-panel.html" rel="nofollow" title="Fuses">Fuses</a></li>
</ul>
</li>
<li><a href="contact_information/contact.html" rel="nofollow" title="Contact Us">Contact Us</a></li>
</ul>
The Javascript
sfHover = function() {
var sfEls = document.getElementById("menu").getElementsByTagName("li");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
this.className+="catalogNav";
}
sfEls[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" catalogNav\\b"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
The CSS that i have created
#wrapper div#header ul li ul.catalogNav{
width:214px;
padding:6px 0 0;
position:absolute;
left:0px;
top:20px;
float:none;
}
#wrapper div#header ul li ul.catalogNav li {
}
#wrapper div#header ul li ul.catalogNav li a{
background: url(../images/black_arrow.gif) no-repeat 2px 8px #fff;;
color:#3B3B3B;
font:11px/21px Arial, Helvetica, sans-serif;
display:block;
padding:0 0 0 13px;
height:21px;
width: 214px;
}
#wrapper div#header ul li ul.catalogNav li a:hover{
background-color:#FFFCE5;
color:#990000;
}