<script&nbs
p;ty
PE="text/javascript">
String.
PRototype.replaceAll = stringReplaceAll;
function stringReplaceAll(AFindText,ARepText){
VAR raRegE
xp = new RegExp(AFindText.replace(/([\(\)\[\]\{\}\^\$\+\-\*\?\.\"\'\|\/\\])/g,"\\$1"),"ig");
return this.replace(raRegExp,ARepText);
}
var ssString="www.cnl
ei.COM;www.CnLei.net;www.cnlei.
org";
alert(ssString.replaceAll("cnlei","iecn"));
ssString="www.${MyName}.com;www.${MyName}.net;www.${MyName}.org";
alert(ssString.replaceAll("${MyName}","cnlei"));
ssString="www.{MyName}.com;www.{MyName}.net;www.{MyName}.org";
alert(ssString.replaceAll("{MyName}","cnlei"));
</script>
<script type="text/javascript">
String.prototype.replaceString = function(s1,s2){
this.str=this;
if(s1.length
==0)return this.str;
var idx=this.str.indexOf(s1);
while(idx>=0){
this.str=this.str.s
ubstring(0, idx)+s2+this.str.substr(idx+s1.length);
idx=this.str.indexOf(s1);
}
return this.str;
}
var ssString="www.cnlei.com;www.CnLei.net;www.cnlei.org";
alert(ssString.replaceString("cnlei","iecn"));
ssString="www.${MyName}.com;www.${MyName}.net;www.${MyName}.org";
alert(ssString.replaceString("${MyName}","cnlei"));
ssString="www.{MyName}.com;www.{MyName}.net;www.{MyName}.org";
alert(ssString.replaceString("{MyName}","cnlei"));
</script>