如题 我想到用
<script language=javascript>
function func_del(path) {
document.form1.delpath.value = path.replace("\\", "\\\\");
document.form1.act.value = "delete";
document.form1.submit();
}
</script><a href='javascript:func_del("<%=myfiles[i].getName()%>")'>删 除</a>
如<%=myfiles[i].getName()%>只要时121\132, 44\3,等中间有“\”的删除时候就会出错我想到了用replace不过不行,replaceAll的javascript不支持,看看谁能有好的想法,或帮我调试一下上边代码,谢谢,小弟初学,在线等
<script language=javascript>
function func_del(path) {
document.form1.delpath.value = path.replace("\\", "\\\\");
document.form1.act.value = "delete";
document.form1.submit();
}
</script><a href='javascript:func_del("<%=myfiles[i].getName()%>")'>删 除</a>
如<%=myfiles[i].getName()%>只要时121\132, 44\3,等中间有“\”的删除时候就会出错我想到了用replace不过不行,replaceAll的javascript不支持,看看谁能有好的想法,或帮我调试一下上边代码,谢谢,小弟初学,在线等
{
var str = @"abc\ppabc"; //@path of your file
var test = str.replace('\\',''); //@replace \
alert(str);
}
这样试试
var strOut = strChk;
while (strOut.indexOf(strFind) > -1) {
strOut = strOut.replace(strFind, strReplace);
}
return strOut;
}
strFind:需要被替换的字符 “\”
strReplace:用来替换的字符 ""