日期:2014-05-19  浏览次数:20458 次

急 js 传值 问题 高手请进 !
我想用js   输出一个带   特殊符号的字符传给我的方法.请问怎么输入呢  
我的方法是这样的
  function   EmailBody(body)
  {
        var   newWindow   =   window.open( " ", "newWindow ");
newWindow.document.open();
newWindow.document.write(body);
newWIndow.document.close();
  }
其中body   是一个页面的HTML内容   我从数据库中取出来   付给一个变量
string   Body= "我的页面内容 ";
EmailBody(Body);这样写不行
请问EmailBody( "这里这么写呢 ");



------解决方案--------------------
友情UP
------解决方案--------------------
EmailBody( " <%= Body.Replace( "\ " ", "\\\ " ")%> ");
------解决方案--------------------
如果有换行的话也要处理.
------解决方案--------------------
escape(body);
------解决方案--------------------
EmailBody( " <%= Body.Replace( "\ " ", "\\\ " ").Replace( "\r\n ", "\\r\\n ")%> ");
------解决方案--------------------
我是中低手.所以虽然会,也就不回答了
------解决方案--------------------
Function Format(formatdata)
formatdata=replace(formatdata, "& ", "&amp; ")
'formatdata=replace(formatdata, " ' ", " ' ' ")
formatdata=replace(formatdata, " < ", "&lt; ")
formatdata=replace(formatdata, "> ", "&gt; ")
formatdata=replace(formatdata, "chr(60) ", "&lt; ")
formatdata=replace(formatdata, "chr(37) ", "&gt; ")
formatdata=replace(formatdata, " " " ", "&quot; ")
'formatdata=replace(formatdata, "; ", ";; ")
formatdata=replace(formatdata,chr(13), " <br> " & chr(13)+chr(10))
format=replace(formatdata,chr(32), "&nbsp; ")
End Function
------解决方案--------------------
还满难的 哈
------解决方案--------------------
body=body.Replace( "\\ ", "\\\\ ");
body=body.Replace( "\ ' ", "\\ ' ");
body=body.Replace( "\t ", "\\t ");
body=body.Replace( "\v ", "\\v ");
body=body.Replace( "\r ", "\\r ");
body=body.Replace( "\n ", "\\n ");
------解决方案--------------------
是一样的嘛,只是稍微改一下replace的用法而已