首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

javascript中prototype步骤修改

2012-10-14 
javascript中prototype方法修改今天做页面时发现了一个方法replace在匹配字符串时SCRIPT LANGUAGEJavaS

javascript中prototype方法修改
今天做页面时发现了一个方法replace在匹配字符串时

<SCRIPT LANGUAGE="JavaScript">String.prototype.replaceAll = function(arg1,arg2){return this.replace(new RegExp(arg1,"g"),arg2);}var str = "asdfsd;asdfasdf;asdfasdfas";alert(str.replaceAll("\;","\|"));</SCRIPT>

在java中replaceAll比replace多的功能就是支持正则表达式

热点排行