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);
};
这可能吗?
最佳答案
不,这是不可能的。
您可以为 this 调用具有指定值的方法(使用 method.apply()
/method .call()
),但您无法重新分配关键字 this
。
关于javascript - 我可以更改 javascript "this"的上下文吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1051237/