<script>x = window.open('http://baidu.com?id='123''); void (x);</script>
我想把'123' 参数也传过去,怎样做?谢谢.
其实我是想实现这个的var strsql="aopp_aopportunityid in(select cwop_recordid from 
cworkflowprogress where cwop_entityname='aopportunity' and ((cwop_userid=175)))";//这个字符串是从数据库读取的Response.write("<script>x = window.open('http://localhost/ReportServer/Pages/ReportViewer.aspx?%2fReport+Project2%2fReport2&rs%
3aCommand=Render&rc%3aParameters=ture&strsql=" + strsql + "');void (x);</script>");
把它合并起来就是下面这句话了:Response.write("<script>x = window.open('http://localhost/ReportServer/Pages/ReportViewer.aspx?%2fReport+Project2%2fReport2&rs%
3aCommand=Render&rc%3aParameters=ture&strsql=aopp_aopportunityid in(select cwop_recordid from 
cworkflowprogress where cwop_entityname='aopportunity' and ((cwop_userid=175)))');void (x);</script>");上面代码一运行时,就报"缺少)"错误.我想问题一定出现在cwop_entityname='aopportunity'  的''符号上.怎样解决这个问题,能不能用正则表达式去实现它.让它变得可行.或者有什么好的解决办法???谢谢.

解决方案 »

  1.   

    <script>x = window.open('http://baidu.com?id=123'); void (x);</script>
    传参数时不需要加引号
      

  2.   

    能不能先用正则表达式把cwop_entityname='aopportunity'  
    的'aopportunity'先变成一个字符串,然后再把它给合起来.这种方法可行吗?谢谢
      

  3.   

    所以现在我怎样用正则表达式把cwop_entityname='aopportunity'  
    的'aopportunity'先变成一个字符串,然后再把它给合起来. 
      

  4.   

    兄弟,不用那么麻烦吧,别忘了UrlEncode()哦
      

  5.   


    用UrlEncode()怎样整,谢谢 
      

  6.   

    你用C#?要引入UtilityUrlEncode()吧,具体你google一下
      

  7.   

    <script>x = window.open("http://baidu.com?id='123'"); void (x); </script>
    直接这样就行了
      

  8.   

    8楼没说明白
    服务端用server.UrlEncode(你要加密的字串)
    客户端JS:用 escape(你要加密的字串)试一下
      

  9.   


    这句话<script>x = window.open("http://baidu.com?id='123'"); void (x); </script> 的"http://baidu.com?id='123'" 双引号在这里Response.write("<script>x = window.open('http://localhost/ReportServer/Pages/ReportViewer.aspx?%2fReport+Project2%2fReport2&rs%
    3aCommand=Render&rc%3aParameters=ture&strsql=aopp_aopportunityid in(select cwop_recordid from 
    cworkflowprogress where cwop_entityname='aopportunity' and ((cwop_userid=175)))');void (x);</script>");已经用过了,再用就有冲突了吧?谢谢.
      

  10.   

    你的帖子很难看懂,
    客户端JS你放这里,服务器代码你也放在这里,别人无法准确理解你的意思哦
    建议:你还是用HTML来发你的代码吧,不然每次都把人搞的稀里糊涂的,哈<%
      dim sql
      sql="aopp_aopportunityid in(select cwop_recordid from cworkflowprogress where cwop_entityname='aopportunity' and ((cwop_userid=175)))"
    Response.write("<script>x = window.open('http://localhost/ReportServer/Pages/ReportViewer.aspx?%2fReport+Project2%2fReport2&rs%
    3aCommand=Render&rc%3aParameters=ture&strsql=server.URLEncode(sql)');void (x);</script>");%>
      

  11.   

    如果还不对,你把整个的URL都encode
    <%
      dim url,sql
      sql="aopp_aopportunityid in(select cwop_recordid from cworkflowprogress where cwop_entityname='aopportunity' and ((cwop_userid=175)))"
      url=server.URLEncode("http://localhost/ReportServer/Pages/ReportViewer.aspx?%2fReport+Project2%2fReport2&rs%
    3aCommand=Render&rc%3aParameters=ture&strsql=sql")  Response.write("<script>x = window.open('"&url&"');void (x);</script>");%>
      

  12.   

    encode之后传过去的参数无需所谓的解密,直接request("xxx")取出来就可以
      

  13.   

    没有,toury兄的回复都很精彩.谢谢了,问题已解决.