PDA

View Full Version : Error: uncaught exception: [Exception... "Component returned failure code: 0x80004003



jsroessler
12-23-2009, 02:08 PM
1) Script Title: All Levels Navigational Menu

2) Script URL (on DD):http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/

3) Describe problem:
I am getting the following error messages and have no Idea how to fix it.
IE 7/8 error code 0 Webpage error details

Message: Invalid argument.
Line: 347
Char: 4
Code: 0
URI: http://www.worldsbestsynthetics.com/worldsbestsynthetics/SSI/ddlevelsmenu.js

Firefox error console:
Error: uncaught exception: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER)" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: line 347" data: no]

CODE IS Here (line 347 in red)

init:function(mainmenuid, dir){
this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
this.topitemsindex=-1
this.ulindex=-1
this.topmenuids.push(mainmenuid)
this.topitems[mainmenuid]=[] //declare array on object
this.subuls[mainmenuid]=[] //declare array on object
this.hidetimers[mainmenuid]=[] //declare hide entire menu timer
if (this.enableshim && !this.shimadded){
this.shimmy={}
this.shimmy.topshim=this.addshimmy(document.body) //create top iframe shim obj
this.shimmy.bottomshim=this.addshimmy(document.body) //create bottom iframe shim obj
this.shimadded=true
}
var menubar=document.getElementById(mainmenuid)
var alllinks=menubar.getElementsByTagName("a")
this.getwindowsize()
for (var i=0; i<alllinks.length; i++){
if (alllinks[i].getAttribute('rel')){
this.topitemsindex++
this.ulindex++
var menuitem=alllinks[i]
this.topitems[mainmenuid][this.topitemsindex]=menuitem //store ref to main menu links
var dropul=document.getElementById(menuitem.getAttribute('rel')) document.body.appendChild(dropul) //move main ULs to end of document
dropul.style.zIndex=2000 //give drop down menus a high z-index
dropul._master=mainmenuid //Indicate which main menu this main UL is associated with
dropul._pos=this.topitemsindex //Indicate which main menu item this main UL is associated with
this.addEvent(dropul, function(){ddlevelsmenu.hidemenu(this)}, "click")
var arrowclass=(dir=="sidebar")? "rightarrowpointer" : "downarrowpointer"
var arrowpointer=(dir=="sidebar")? this.arrowpointers.rightarrow : this.arrowpointers.downarrow
if (this.arrowpointers.showarrow.toplevel)
this.addpointer(menuitem, arrowclass, arrowpointer, (dir=="sidebar")? "before" : "after")
this.buildmenu(mainmenuid, menuitem, dropul, this.ulindex, true, dir) //build top level menu
dropul.onmouseover=function(){
clearTimeout(ddlevelsmenu.hidetimers[this._master][this._pos])
}
this.addEvent(dropul, function(e){ //hide menu if mouse moves out of main UL element into open space
if (!ddlevelsmenu.isContained(this, e) && !ddlevelsmenu.isContained(ddlevelsmenu.topitems[this._master][parseInt(this._pos)], e)){
var dropul=this
if (ddlevelsmenu.enableshim)
ddlevelsmenu.hideshim()
ddlevelsmenu.hidetimers[this._master][this._pos]=setTimeout(function(){
ddlevelsmenu.hidemenu(dropul)
}, ddlevelsmenu.hideinterval)
}
}, "mouseout")
var subuls=dropul.getElementsByTagName("ul")
for (var c=0; c<subuls.length; c++){
this.ulindex++
var parentli=subuls[c].parentNode
if (this.arrowpointers.showarrow.sublevel)
this.addpointer(parentli.getElementsByTagName("a")[0], "rightarrowpointer", this.arrowpointers.rightarrow, "before")
this.buildmenu(mainmenuid, parentli, subuls[c], this.ulindex, false, dir) //build sub level menus
}
}
} //end for loop
this.addEvent(window, function(){ddlevelsmenu.getwindowsize(); ddlevelsmenu.gettopitemsdimensions()}, "resize")
},

setup:function(mainmenuid, dir){
this.domready(function(){ddlevelsmenu.init(mainmenuid, dir)})
}

}

ddadmin
12-23-2009, 10:12 PM
I assume worldsbestsynthetics.com/worldsbestsynthetics/ is the page in question. Try disabling the 4th menu bar on you page:


<script type="text/javascript">
ddlevelsmenu.setup("ddtopmenubar", "topbar")

//ddlevelsmenu.setup("mainmenuid", "topbar|sidebar")
ddlevelsmenu.setup("ddtopmenubar1", "topbar")

//ddlevelsmenu.setup("mainmenuid", "topbar|sidebar")
ddlevelsmenu.setup("ddtopmenubar2", "topbar")

//ddlevelsmenu.setup("mainmenuid", "topbar|sidebar")
ddlevelsmenu.setup("ddtopmenubar3", "topbar")

//ddlevelsmenu.setup("mainmenuid", "topbar|sidebar")
//ddlevelsmenu.setup("ddtopmenubar4", "topbar")

//ddlevelsmenu.setup("mainmenuid", "topbar|sidebar")
</script>

Notice the "//" proceeding the 4th menu bar code above, to disable it. I suspect that's the culprit, since "ddtopmenubar4" references a SPAN on your page, instead of the required UL element.

BTW, please note that your page is currently in violation of our usage terms, since the credit notice doesn't appear inline on the page. Please reinstate the credit notice: http://www.dynamicdrive.com/notice.htm

jsroessler
12-24-2009, 03:20 AM
Thanks for the reply. I have added the credit notice to the script tags directly on the page. Unfortunately disabling that menubar did not resolve the issue, just disabled the dropdown. Also tried changing from span to ul id but no luck there either. Any further suggestions would be appreciated. The page can be accessed directly at http:worldsbestsynthetics.com/test.shtml (http://worldsbestsynthetics.com/test.shtml)

jsroessler
12-24-2009, 05:41 AM
By process of elimination I fixed the error by disabling the ddtopmenubar3.
//ddlevelsmenu.setup("mainmenuid", "topbar|sidebar")
//ddlevelsmenu.setup("ddtopmenubar3", "topbar")

I still can't find what is causing the error. The code for ddtopmenubar3 is:


<tr>
<td class="navbrder bgnav"><table align="center">
<tr>
<td>
<ul style="margin:0" id="ddtopmenubar3" class="mattblackmenu ver11white">
<li><a href="http://worldsbestsynthetics.com/oil-testing.shtml" class="ver11white" rel="ddsubmenu27">Oil Analysis</a></li>
<li><a href="https://www.amsoil.com/company.aspx?zo=1607375" class="ver11white" rel="ddsubmenu28">Amsoil info</a></li>
<li><a href="https://www.amsoil.com/techservices.aspx?zo=1607375" class="ver11white" rel="ddsubmenu29">Ask Amsoil </a></li>
<li><a href="http://www.worldsbestsynthetics.com/lit/interval_change_guide_g1490.pdf" class="ver11white" rel="ddsubmenu30">Oil Change Interval Guide</a></li>
</ul></td>
</tr>
</table></td>
</tr>

I would like to find the problem, so I can expand these menus in the future. Any help is greatly appreciated.
Thanks,

J.S. Roessler

jscheuer1
12-24-2009, 05:58 AM
A problem, perhaps the problem, as I've seen this sort of thing many times, is that there are no corresponding drop downs for those rel attributes. For example, where you have:


<a href="http://worldsbestsynthetics.com/oil-testing.shtml" class="ver11white" rel="ddsubmenu27">

This tells the script to look for an element with the id of 'ddsubmenu27', none exists, so it throws an error. The same is true of ddsubmenu28, ddsubmenu29, and ddsubmenu30.

So, you either need to make those, or remove the rel attributes. If you choose to remove them all, may as well not init that submenu group.

jsroessler
12-24-2009, 06:11 AM
The error was because I had not specified the individual ddsubmenu items. The Proper code was:

<tr>
<td class="navbrder bgnav"><table align="center">
<tr>
<td><ul id="ddsubmenu26" class="ddsubmenustyle">
<li class="bder"><a href="#" onclick="aFunction();return false;">ALL</a></li></ul>
<ul id="ddsubmenu27" class="ddsubmenustyle">
<li class="bder"><a href="#" onclick="aFunction();return false;">ALL</a></li></ul>
<ul id="ddsubmenu28" class="ddsubmenustyle">
<li class="bder"><a href="#" onclick="aFunction();return false;">ALL</a></li></ul>
<ul id="ddsubmenu29" class="ddsubmenustyle">
<li class="bder"><a href="#" onclick="aFunction();return false;">ALL</a></li>
</ul>
<ul style="margin:0" id="ddtopmenubar3" class="mattblackmenu ver11white">
<li><a href="http://worldsbestsynthetics.com/oil-testing.shtml" class="ver11white" rel="ddsubmenu26">Oil Analysis</a></li>
<li><a href="https://www.amsoil.com/company.aspx?zo=1607375" class="ver11white" rel="ddsubmenu27">Amsoil info</a></li>
<li><a href="https://www.amsoil.com/techservices.aspx?zo=1607375" class="ver11white" rel="ddsubmenu28">Ask Amsoil </a></li>
<li><a href="http://www.worldsbestsynthetics.com/lit/interval_change_guide_g1490.pdf" class="ver11white" rel="ddsubmenu29">Oil Change Interval Guide</a></li>
</ul></td>
</tr>
</table></td>
</tr>

It is working fine now, Thank you for the info on where to look. Much appreciated.

jsroessler
12-24-2009, 06:15 AM
Just what I found. Added the corresponding menus and just like magic it was fixed. Thanks!