Javascript替换字符串中字符
//将字母i全部替换成5(使用正则表达式)
<script language="javascript">
var txt = "sjfisjfisdjfijsidfjioalfjewofjjgs";
alert(txt .replace(/i/g,"5"));
</script>
//只将第一个字母i替换成5
<script language="javascript">
var txt = "sjfisjfisdjfijsidfjioalfjewofjjgs";
alert(txt .replace("i","5"));
</script>