首页 新闻 赞助 找找看

这段脚本有错吗

0
悬赏园豆:10 [已解决问题] 解决于 2009-05-24 11:25

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();

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

问题补充: 怎么输的代码丢失啊,我重新输一遍 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();
奋斗的小涛的主页 奋斗的小涛 | 初学一级 | 园豆:135
提问于:2009-05-22 23:21
< >
分享
最佳答案
0

楼主,我给你改了一下.
new ((function()
{
var a=function(txt)
{
this.text=txt;
};
a.prototype={
show:function(){alert(this.text);}
}
return a;
})())("Do you miss me?").show();

I,Robot | 大侠五级 |园豆:9783 | 2009-05-23 09:24
其他回答(1)
0

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

这里最后少一个分号

其他看不出问题,代码蛮好的,不觉得是楼上说的胡搞

Gray Zhang | 园豆:17610 (专家六级) | 2009-05-23 01:32
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册