CNET中国旗舰网站

ZDNet China | CNET科技资讯网 | 政府采购 | 行业网站联盟





 
标题: [转贴] Object.extend(a,fun)是否等效于a.prototype.xx=fun?
mz89757053
版主
Rank: 7Rank: 7Rank: 7


UID 304999
精华 0
积分 6933
帖子 8295
威望 116
ZD币 1002 元
阅读权限 250
注册 2008-3-10
状态 离线
  楼主
发表于 2008-3-18 16:01  资料  个人空间  短消息  加为好友 
开发者在线

Object.extend(a,fun)是否等效于a.prototype.xx=fun?

对于prototype.js,以下量段代码是否等效?   
  1:   
  Object.extend(String.prototype,   {   
      stripTags:   function()   {   
          return   this.replace(/<\/?[^>]+>/gi,   '');   
      },   
   
      stripScripts:   function()   {   
          return   this.replace(new   RegExp(Prototype.ScriptFragment,   'img'),   '');   
      }   
  )   
   
  2:   
  String.prototype.stripTags=   function()   {   
          return   this.replace(/<\/?[^>]+>/gi,   '');   
      }   
  String.prototype.stripScripts=   function()   {   
          return   this.replace(new   RegExp(Prototype.ScriptFragment,   'img'),   '');   
      }




顶部
热点频道推荐: C/S开发| 数据库| WEB开发| 嵌入式| 项目管理|
 



当前时区 GMT+8, 现在时间是 2009-7-4 14:16

  Powered by Discuz! 5.5.0 © 2001-2007 Comsenz Inc.
Processed in 0.066831 second(s), 3/3 queries

清除 Cookies - 联系我们 - ZDNetChina中文社区 - 无图版