我有一个问题,我创建的对象看起来像这样:
var myObject = {
AddChildRowEvents: function(row, p2) {
if(document.attachEvent) {
row.attachEvent('onclick', function(){this.DoSomething();});
} else {
row.addEventListener('click', function(){this.DoSomething();}, false);
}
},
DoSomething: function() {
this.SomethingElse(); //<-- Error here, object 'this' does not support this method.
}
}
问题是当我进入'DoSomething'函数时,'this'不会引用'myObject'我做错了什么?
一只名叫tom的猫
慕村225694
宝慕林4294392
相关分类