www.webdeveloper.com
Results 1 to 3 of 3

Thread: This Script is causing an Error on IE 6/7. Help?

Hybrid View

  1. #1
    Join Date
    Sep 2009
    Posts
    2

    Exclamation This Script is causing an Error on IE 6/7. Help?

    When I removed this script from my site, the "Object Required" Error on Page message disappeared. IE says the error is on line 5, char 11... but that doesn't make sense to me. any pointers??

    If it helps, this code was something i found to help a CSS dropdown menu function properly.

    Code:
    startList = function() {
    if (document.all&&document.getElementById) {
    navRoot = document.getElementById("ulnav");
    for (i=0; i<navRoot.childNodes.length; i++) {
    node = navRoot.childNodes[i];
    if (node.nodeName=="LI") {
    node.onmouseover=function() {
    this.className+=" over";
      }
      node.onmouseout=function() {
      this.className=this.className.replace(" over", "");
       }
       }
      }
     }
    }
    window.onload=startList;

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    At a first glance:
    Code:
    if (document.all&&document.getElementById)
    That will exclude all the browsers except IE. That means I doubt that code works in any browser at all, if you say IE won't run it. You don't need that condition. All the browsers on use now knows what document.getElementById means

  3. #3
    Join Date
    Sep 2009
    Posts
    2
    I'm not sure exactly why it was there in the first place... when the script is removed, the site still functions correctly in IE 6&7.

    so, thanks!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles