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);
};
ist das möglich? Danke, ~ ck in San DiegoKann ich den Kontext von Javascript "this" ändern?
Siehe die Antwort auf diese Frage: http://stackoverflow.com/questions/456967/javascript-how-to-set-this-variable-easily – molf
yepp, mehr oder weniger ein Duplikat von http: // stackoverflow. com/questions/456967/javascript-how-to-set-this-variable-leicht Die akzeptierte Antwort war Aufruf()/apply(), siehe https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Function/apply – VolkerK
Das ist einfach zu verwirrend. Alle Antworten sagen nein, du kannst es nicht tun. Offenbar, die Antworten auf die doppelte Frage, ja, Sie können es tun. Stelle dir das vor. – DOK