日期:2014-05-16 浏览次数:20481 次
function AAA(id){//创建对象
this.id=id;
this.test = function(){
var obj = this;//重点,先用变量接受本对象
ActionMgr.post('test.action','test',function(request, result){//模拟回调函数
alert(obj.id);//正确写法
//alert(this.id);//这是错误写法,这样写得到的结果是undefined
});
}
}
?