网站制作学习网JS脚本→正文:js字符串替换
字体:

js字符串替换

JS脚本 2008/12/3 8:42:09  点击:不统计

关键词:js替换,js字符串替换,js字符串替换函数

<script>

function check()

{var tempstr

tempstr=ReplaceAll(document.form.temp.value,",","*")

alert(tempstr);

}

function ReplaceAll(str, sptr, sptr1)

{

while (str.indexOf(sptr) >= 0)

{

str = str.replace(sptr, sptr1);

}

return str;

}

</script>

<form onsubmit="check();" name="form">

<input type="text" size="58" name="temp"/>

<input type="submit" value="asdf" />

</form>

·上一篇:js判断年月日格式是否正确 >>    ·下一篇:js清空select的所有option >>
推荐文章
最新文章