日期:2014-05-16  浏览次数:20380 次

替换/为空(急,在线等,立即结贴)
var   x   =   "07/10/10 "
var   re   =   new   RegExp(x.replace( "/ ", " "), "gi ");
alert(x.replace(re, " "));

这段代码为什么替换不了   /

------解决方案--------------------
var x = "07/10/10 "
var re = /\//g;
alert(x.replace(re, " "));
------解决方案--------------------
alert(x.replace(/\//ig, " "));
------解决方案--------------------
<script>
var x = "07/10/10 ";
var re = new RegExp( "/ ", "gi ");
alert(x.replace(re, " "));
</script>