• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • Last Modified:

HTML Dog javascript edit

I grabbed code from htmldog to create drop down menus.  The drop downs shift to the right when viewed in IE6.  I am not familiar with javascript.  Is there any edits I can do to the script to make this function slightly better?

Html Dog original script that works good in IE 6

The drop downs on my site are under the "Our Kids" and "Photos" buttons:

The css is here:

<script type="text/javascript"><!--//--><![CDATA[//><!--
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);

Open in new window

1 Solution
David S.Commented:
The dropdown menus aren't working in IE6 or IE7. I don't see why they aren't working in IE7, but they aren't working in IE6, because you didn't include the script in that page.

Anyway, to get them to line up correctly in IE, give "#navigation li" position:relative and change

#navigation li:hover ul, #navigation li.sfhover ul { /* lists nested under hovered list items */


#navigation li:hover ul, #navigation li.sfhover ul { /* lists nested under hovered list items */
        left: 0;

nsitedesignsAuthor Commented:

p.s.  I did forget to add the javascript to the internal gallery pages.  All the other pages on the site have the script added.


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now