<script language="javascript">
//参数一为被替换的字符串 参数二为被匹配的字符串 参数三为替换后的字符串
function replaceAll(str, sptr, sptr1){
while (str.indexOf(sptr) >= 0)
{
str = str.replace(sptr, sptr1);
}
return str;
}
var a = "abcdddacfffaffff";
var b = "a";
var c = "";
var d= replaceAll(a,b,c)
alert(d);
</script>