猿问

这段脚本有错吗

var a={

A:function()

  {

     var a=function(txt)

  {

     this.text=txt;

alert(this.text);

           };

     a.prototype={

   show:function(){alert(this.text);}

}

     return a;

  }();

}

 

var b=new a.A("Do you miss me?");

b.show();

以上脚本有错吗,为什么不弹啊?


网站开发Javascript

问题补充: 怎么输的代码丢失啊,我重新输一遍 A:function() { var a=function(txt) { this.text=txt; }; a.prototype={ show:function(){alert(this.text);} } return a; }(); } var b=new a.A("Do you miss me?"); b.show();


精慕HU
浏览 888回答 2
2回答

翻翻过去那场雪

a.prototype={show:function(){alert(this.text);}}这里最后少一个分号其他看不出问题,代码蛮好的,不觉得是楼上说的胡搞
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答