Reputation: 13760
I want to have a collection of functions in the class T, defined below.
function T(){
this.Funcs = new Array();
this.appendEvt=function(Obj, Evt, Act){
switch(Evt){
case "onclick":
this.Funcs.push(function(){Obj.onclick=Act;});
break;
}
};
These functions are stored in a array of class T (Funcs). This functions must be of the form:
Funcs[i]=function(){Obj.Event=FuncWhichContainsActionsWhenTheEventIsTriggered;}
The question is, how can I pass as a parameter any event, like onclick, or "onmouseover,..., so I am able to rewrite the function this.appendEvt like this?:
this.appendEvt=function(Obj, Evt, Act){
this.Funcs.push(function(){Obj.Evt=Act;});
};
Upvotes: 0
Views: 131