Rival
Joined: 12 Mar 2007 Posts: 2
|
Posted: Mon Mar 12, 2007 11:17 am Post subject: Type mismatch |
|
|
I'm trying to adapt someone elses code to also output a extra image given a certain parameter. For some reason I get the following error:
--------------------
JavaScript - http://localhost:8080/aha/ViewGet/adaptive/?view=treefrm&concept=adaptive.index
Inline script thread
Error:
name: TypeError
message: Statement on line 809: Type mismatch (usually a non-object value used where an object is required)
Backtrace:
Line 809 of linked script http://localhost:8080/aha/adaptive/scripts/ftiens4.js
return parentFolder.addChildDot(todotornottodot, document);
Line 202 of linked script http://localhost:8080/aha/adaptive/scripts/menuNodes.js
aux1 = insFld(foldersTree, gFld("Test", "javascript:parent.op()"));
aux2 = insDocDot(aux1, gLnk("R", "Test", "nolink"), 0);
--------------------
The code I'm trying to adapt looks like this:
(Note: this code works!)
--------------------
| Code: |
aux2 = insDoc(aux1, gLnk("R", "Sheet 63", "week4/img63.html"))
function insDoc(parentFolder, document)
{
return parentFolder.addChild(document)
}
function addChild(childNode)
{
this.children[this.nChildren] = childNode
childNode.parentObj = this
this.nChildren++
return childNode
}
|
--------------------
My adaptation looks like this:
(the code that doesn't work)
--------------------
| Code: |
aux2 = insDocDot(aux1, gLnk("R", "Test", "nolink"), 0)
function insDocDot(parentFolder, document, todotornottodot)
{
return parentFolder.addChildDot(todotornottodot, document);
}
function addChildDot(todotornottodot, childNode)
{
// this.childrenDot[this.nChildrenDot] = todotornottodot
// this.nChildrenDot++
this.children[this.nChildren] = childNode
childNode.parentObj = this
this.nChildren++
return childNode
}
|
--------------------
Do you guys have any idea what is going wrong? |
|