Results 1 to 2 of 2

Thread: Problem with script when returning from ajax

  1. #1
    Join Date
    Jun 2008
    Posts
    10
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Problem with script when returning from ajax

    Hi all... I post this here because the DD forums have been so helpful to me so far.

    My problem is this. I am using DD DHTML Window widgets with great success in a large application for my company. Using the following script I create dynamic drop down menus. If I return all my windows as IFrames all works well, but that is not feasible due to internal factors. So I converted all of my windows to the "ajax" type. I'm asking this here because the problem isn't with the DHTML Window Widget, but rather Internet Explorer handling this javascript when its being returned from ajax. Firefox handles it absolutely fine. Can anyone advise how to get IE to use this script properly?

    The script I'm referencing below is included in the page via this line in the head section

    Code:
    <script type="text/javascript" src="nav.js"></script>
    And here are the contents of nav.js

    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);

    The error I'm getting is this ...

    Error: 'document.getElementById(...)' is null or not an object


    Again, thanks in advance for your advice and help!

  2. #2
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,859
    Thanks
    49
    Thanked 260 Times in 252 Posts
    Blog Entries
    56

    Default

    What is happening in IE when you leave out the 'document':

    var sfEls = getElementById("nav").getElementsByTagName("LI");?
    ---
    Arie Molendijk.

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
  •