| | |
Drop Down Menu with Sucker Fish
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
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
The Javascript
The CSS that i have created
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
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<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
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
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
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
#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; }
Sorry to keep you waiting! Here's your code and ive fixed some of the lines in your script.
html Syntax (Toggle Plain Text)
<html> <head> <title><!--Sample--></title>
css Syntax (Toggle Plain Text)
<style type="text/css"> <!-- /* Part of the testing that's why i have to simplify things. Just dont forget to replace this one with ur default attribution */ li.blue a { color: blue; } li.yellow { background-color: yellow; } --> </style>
javascript Syntax (Toggle Plain Text)
<script type="text/javascript"> <!-- function sfHover() { for ( var x = 0; x <= document.getElementsByTagName('ul').length; x++ ) { var sfEls = document.getElementsByTagName('ul')[x].getElementsByTagName('li'); for ( var i = 0; i <= sfEls.length; i++ ) { sfEls[i].onmouseover = function() { this.className += " yellow"; }; sfEls[i].onmouseout = function() { this.className = this.className.replace(/yellow/g, ''); } } } } if ( window.addEventListener ) window.addEventListener("load", sfHover, false ); else if ( window.attachEvent ) window.attachEvent ("onload", sfHover); else if ( document.getElementById ) window.onload = sfHover; //--> </script>
html Syntax (Toggle Plain Text)
</head> <body> <ul id="menu"> <li class="blue"><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></li> <!--Here's where you got those headache! Just try to observe this line of your code. Something is missing but all things got fixed now! --> <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> </body> </html>
![]() |
Similar Threads
- CSS drop menu work in FFox not IE (HTML and CSS)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Single variable multiple select box
- Next Thread: Firefox is checking my checkbox after a return false for validation
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxhelp animate automatically beta box browser bug calendar captchaformproblem checkbox child class close column cookies createrange() css cursor decimal dependent design disablefirebug dom download dropdown editor element engine error events explorer ext file form forms google gwt gxt highlightedword html htmlform ie8 iframe image() images index internet java javascript jawascriptruntimeerror jquery jsf jsfile jump listbox math microsoft mimic mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent pdf php player post problem progressbar rated rating regex runtime scroll search select session shopping size sql star starrating stars synchronous text textarea validation w3c web website window windowofwords windowsxp wysiwyg xml \n





