SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jul 2006
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Son of Suckerfish causing IE pageload error

    I have validated my html, php and css from W3C on the website I am currently working on.

    I have found that implementing the Son of Suckerfish dropdown menu works well in Firefox, but not at all in IE. I believe the javascript from the sfHover.js file is causing this pageload error in IE:
    Code:
    Line: 3
    Char: 2
    Error: 'document.getElementByld(...)' is null or not an object
    Code: 0
    URL:http://www.umedplans.com/index2.php
    If I comment out the call for it in the header of my webpage, no error occurs. I have recopied and pasted from the above link several times to make sure I didn't mess the code up accidentally, and I am sure it is clean. Here is the javascript from Son of Suckerfish:
    Code:
    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);

    Does anyone have any ideas why this is doing this or how to fix it?

  2. #2
    SitePoint Evangelist vikrantkorde's Avatar
    Join Date
    Jun 2004
    Location
    Mumbai, India
    Posts
    541
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The only error i can see is that the the object with id="nav" is not present in the page at all. It is case sensitive.
    Vikrant Korde
    S Y S T I M E, Mhape,
    Mumbai, Maharashtra, India.

  3. #3
    SitePoint Member
    Join Date
    Jul 2006
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What exactly do you mean? And how do I fix that?

  4. #4
    SitePoint Member
    Join Date
    Jul 2006
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vikrant, thank you so much for your help. I changed up the code and it's working properly now. If you look at my html, you'll see that in the navigation menu section, I had to change the one dropdown I was trying to use (Products) to id="nav" and the other ones to a new class called "nav2." Do you think there's any way I can setup the sfHover to work with every dropdown? or do I need to replicate the javascript and have it say "nav", "nav2", "nav3", etc. Because I was trying to use "nav" as a class and not as an id so that it would work on all of the menu items. I found that it HAS to be an id in the css for this particular javascript to work. Any suggestions on how to make it work with every menu item, so that dropdowns are easily updatable later on?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •