var UI$Contract$ddlForm_change = function() {
//'this' is currently the drop down that fires the event
// My question is can I change the context so "this" represents another object?
this = SomeObject;
// then call methods on the new "this"
this.someMethod(someParam);
};
est-ce possible? Merci, ~ ck à San DiegoPuis-je changer le contexte de javascript "this"?
Voir la réponse à cette question: http://stackoverflow.com/questions/456967/javascript-how-to-set-this-variable-easily – molf
yepp, plus ou moins un doublon de http: // stackoverflow. com/questions/456967/javascript-comment-définir-cette-variable-facilement La réponse acceptée était d'utiliser call()/apply(), voir https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Function/apply – VolkerK
Ceci est juste trop confus. Toutes les réponses disent non, vous ne pouvez pas le faire. Apparemment, les réponses à la question en double façon oui, vous pouvez le faire. Allez comprendre. – DOK