||View All MessagesBack to WebFX|
What happens is that the this of the "this.remove" refers to the newNode object, which does not possess the method removes, nor nothing of the class node, but is really another class and object. Soon for that execute must be kept the true "this" in the created newNode object.
It explains the line: this.newNode.obj = this; and the use of it.
From: Micha Schopman
Sent: September 29, 2003
Subject: Re:Adding functions with object prototyping
it is a bit confusing for me what happens with this
this.newNode.obj = this;
I do not really get why something like
this.newNode.onclick = new Function("this.remove()");
does not work. When you see it like this, you expect you make a reference to node.remove(); But after all you could expect this.remove references to the div it is appended to.
I guess it is a mather of thinking to difficult. Quite annoying actually..