<SCRIPT LANGUAGE="JavaScript">
var s = 'C:\\My Documents\\html\Tv';
str = s.replace(/\\/g,"\\\\");//没用 ? -- 有用
alert(str);
</SCRIPT>

解决方案 »

  1.   

    javascipt字符串中,用"\\" 表示 \, "\\\\"表示 \\
      

  2.   

    出了字符串 ,C:\\My Documents\\html\\Tv 是没有意义的路径名
      

  3.   

    不过结果为;
    C:\\My Documents\\htmlTv
      

  4.   

    <SCRIPT LANGUAGE="JavaScript">
    var s = 'C:\\My Documents\\html\\Tv';
    str = s.replace(/\\/g,"\\\\");//没用 ? -- 有用
    alert(str);
    </SCRIPT>
      

  5.   

    to: onestab(一刺) 
    你是来找乐的吧,你都var s = 'C:\\My Documents\\html\\Tv';了,还转什么转