Hey,
This is probably just a question of syntax but i cant figure it out!
i have a javascript class with several functions, one being something like ...
In the following line:
How do i make the otherfunction() part reference the current class, obviously this. doesnt work as the element is appended somewhere within the html doc and the onclick even looks for some global function called otherfunction, not within the TreeView class.
any ideas? (or a work around)
Ta
Andy
This is probably just a question of syntax but i cant figure it out!
i have a javascript class with several functions, one being something like ...
Code:
TreeView.prototype.showItems = function(id) {
itemImg = document.createElement("img");
itemImg.src = "images/treeplus.gif";
itemImg.onclick = function(){this.otherfunction();
document.appendChild(itemImg);
}
TreeView.prototype.otherfunction = function(id) {
//do something
}
Code:
itemImg.onclick = function(){this.otherfunction();
any ideas? (or a work around)
Ta
Andy
Comment