B
bruestle
I've been working on improving my javascript coding and decided to
start using classes. I've gotten pretty far but am having problems
attaching a member function to a control event.
CBonfireStore.prototype.setupClick = function( obj )
{
obj.onclick = function(){ this.incrementClicked(obj); };
obj.style.cursor = 'pointer';
}
The above does not work. If I take away the this. infrom of the
incrementClicked(obj), and point to a non-member version of the
function, every works OK.... but that's not what I want. I do I get
this to use the method of the current instance?
John
start using classes. I've gotten pretty far but am having problems
attaching a member function to a control event.
CBonfireStore.prototype.setupClick = function( obj )
{
obj.onclick = function(){ this.incrementClicked(obj); };
obj.style.cursor = 'pointer';
}
The above does not work. If I take away the this. infrom of the
incrementClicked(obj), and point to a non-member version of the
function, every works OK.... but that's not what I want. I do I get
this to use the method of the current instance?
John