PDA

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



AmyL
04-07-2010, 04:22 PM
1) Script Title: Drop down/ Overlapping Content

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex5/overlapcontent.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/showthread.php?t=52146&highlight=drop+Overlapping+Content+script

By doing this...

Old 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:


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.

ddadmin
04-07-2010, 07:33 PM
Please post a link to the page on your site that contains the problematic script so we can check it out.

AmyL
04-07-2010, 08:02 PM
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.

ddadmin
04-08-2010, 03:01 AM
Ah yes that code doesn't account for all possible scenarios. Instead of the original:


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:


init:function(anchorid, pos, glidetime, revealbehavior){
var anchorobj=document.getElementById(anchorid)
if (anchorobj)
var subobj=document.getElementById(anchorobj.getAttribute("rel"))
if (!anchorobj || !subobj)
return

AmyL
04-08-2010, 11:42 AM
That worked!

Thank you so very much.