Results 1 to 5 of 5

Thread: Drop down/ Overlapping Content Script - IE Error (Null is not an object)

  1. #1
    Join Date
    Apr 2010
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Drop down/ Overlapping Content Script - IE Error (Null is not an object)

    1) Script Title: Drop down/ Overlapping Content

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...lapcontent.htm

    3) Describe problem: I have this script installed and it's working well on FF, but on IE, I get this error:

    Line: 116
    Error: 'null' is null or not an object


    I applied the fix as indicated on this forum post: http://www.dynamicdrive.com/forums/s...Content+script

    By doing this...

    Old code:

    Code:
    114 init:function(anchorid, pos, glidetime, revealbehavior){
    115 var anchorobj=document.getElementById(anchorid)
    116 var subobj=document.getElementById(anchorobj.getAttribute("rel"))
    117 var subobjsource=anchorobj.getAttribute("rev")
    118 if (subobjsource!=null && subobjsource!="")
    119 this.ajaxconnect(subobjsource, anchorobj.getAttribute("rel"))
    120 subobj.dropposition=pos.split("-")
    121 subobj.glidetime=glidetime || 1000
    122 subobj.style.left=subobj.style.top=0

    New code:

    Code:
    114 init:function(anchorid, pos, glidetime, revealbehavior){
    115 var anchorobj=document.getElementById(anchorid)
    116 var subobj=document.getElementById(anchorobj.getAttribute("rel"))
    117 if (!anchorobj || !subobj)
    118	return
    119 var subobjsource=anchorobj.getAttribute("rev")
    120 if (subobjsource!=null && subobjsource!="")
    121 this.ajaxconnect(subobjsource, anchorobj.getAttribute("rel"))
    122 subobj.dropposition=pos.split("-")
    123 subobj.glidetime=glidetime || 1000
    124 subobj.style.left=subobj.style.top=0
    But I'm still getting the error.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Please post a link to the page on your site that contains the problematic script so we can check it out.
    DD Admin

  3. #3
    Join Date
    Apr 2010
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Here you go: http://slmwaste.com/wp/about-slm/why-slm/

    The only page it doesn't give the error is on the page where the script is called.

    http://slmwaste.com/wp/about-slm/slm-family/

    The calls to it are in my header file, though, so the script is on every page of the site.

  4. #4
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Ah yes that code doesn't account for all possible scenarios. Instead of the original:

    Code:
     init:function(anchorid, pos, glidetime, revealbehavior){
    		var anchorobj=document.getElementById(anchorid)
    		var subobj=document.getElementById(anchorobj.getAttribute("rel"))
    		if (!anchorobj || !subobj)
    			return
    Try changing that to:
    Code:
     init:function(anchorid, pos, glidetime, revealbehavior){
    		var anchorobj=document.getElementById(anchorid)
    		if (anchorobj)
    			var subobj=document.getElementById(anchorobj.getAttribute("rel"))
    		if (!anchorobj || !subobj)
    			return
    DD Admin

  5. The Following User Says Thank You to ddadmin For This Useful Post:

    AmyL (04-08-2010)

  6. #5
    Join Date
    Apr 2010
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    That worked!

    Thank you so very much.

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
  •