js的优化后的replace函数
<script language="JavaScript">
function Replace(replaceStr , oldchar , newchar , flag)
{
if(typeof(flag)=="undefined") flag = "g" ;
var re = new RegExp(oldchar,[flag]) ;
return replaceStr.replace(re,newchar);
}
alert(Replace("abcdeAbcdef",'a','777','ig'));
</script>