这个正则怎么写呢<script>
var str="<img height="467" alt="" src="/upload/njlh/yjb/Image/IMG_7602(4).JPG\" width="700" />fd";
str = str.replace………………………… 怎么" 替换为 \" 替换了 才能js读取
alert(str);
</script>

解决方案 »

  1.   

    ......
    啥意思?
    var str='<img height="467" alt="" src="/upload/njlh/yjb/Image/IMG_7602(4).JPG\" width="700" />fd';直接这样声明不就行了么?
      

  2.   

    var str='<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><img height="467" alt="" src="/upload/njlh/yjb/Image/IMG_7602(4).JPG" width="700" /></p><p><img height="467" alt="" src="/upload/njlh/yjb/Image/IMG_7641.JPG" width="700" /></p><p><font size="4"><span lang="EN-US">2010</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">年</span><span lang="EN-US">10</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">月</span><span lang="EN-US">13</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">日下午,南京市应急管理工作检查组一行</span><span lang="EN-US">6</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">人在市应急管理办公室主任刘建华的带领下,来我区检查应急队伍建设等有关工作。区领导车道正带领区应急办、安监局、公安分局、法制办、财政局、消防大队等部门迎接了检查。会上,市应急办刘主任要求我区落实和加快第二消防站的建设,进一步提升我区应急救援的处置能力。</span></font></p>';
      

  3.   

    先把需要js处理的数据在后台用HTML编码一次,这样传到前台再用js处理
      

  4.   

    麻烦帮忙顶一下帖子:http://topic.csdn.net/u/20101204/00/e8d7de71-577d-4fb2-9291-a734f4641027.html
      

  5.   

    直接读出来的?也就是没有声明?那试试这个
    str = str.replace(/\'/, "\\'");
      

  6.   

    .replace(/\"/,"\\"");字符粗韩本身的引号不会计算的