<!DOCTYPE html>
var prion = {
x:0,
y:0,
MoveX:function(x){
this.x = this.x+x;
alert(this.x);
},
/*这段代码注释掉就能运行,不注释就不行,请告诉一下问题出在哪儿*/
MoveY:function(y){
var testy = function(y){
this.y = this.y+y;
alert(this.y);
}
}
}
问题出在
MoveY:function(y){
var testy = function(y){
this.y = this.y+y;
alert(this.y);
};
};
去掉最后那个分号应该就可以
取消之后:
[color=red]MoveX:function(x){
this.x = this.x+x;
alert(this.x);
}[/color]这里加个逗号分隔试试?