JavaScript 下面这段代码不知道问题在哪儿

<!DOCTYPE html>


关于this的测试



<br> //&lt;![CDATA[</p> <pre><code>this.y=2; 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); }; };*/ } window.onload = function main(){ alert(&quot;11&quot;); prion.MoveX(3); prion.x; prion.MoveY(3); prion.y; } //]]&gt; &lt;/script&gt; </code></pre> <p></body><br> </html></p>

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]这里加个逗号分隔试试?