我將取代c:\pictures\picture1.png
到c:\\pictures\\picture1.png
jQuery的一個字符串替換特殊字符
即:
var data="c:\pictures\picture1.png"
data=data.raplace('\','\\');
在asp.net它可以與
data=data.replace('\\','\\\\');
運行,當我在使用此方法jquery它只取代冷杉的'\'字符,它來這樣:
c:\\pictures\picture1.png
我怎麼能代替所有「\」字符
看看這個線程http://stackoverflow.com/questions/9708653/jquery-javascript-find-and-replace-all-instances – 2013-03-19 14:55:28
謝謝它與data.replace(/ \\/g,'\\ \\') – 2013-03-19 15:00:00