在ASP.NET页面中我写了这样一段代码 <script type="text/javascript" src="http://www.xxxx.com/article/info/gk.aspx?name="+document.location.href+"&pwd=+"document.URL></script>
这个链接带有两个参数,也就是获得客户端访问的URL,就是通过js的document.location.href获取URL,但是问题来了,在 <script type="text/javascript" src="http://www.xxxx.com/article/info/gk.aspx?name="+document.location.href+"&pwd=+"document.URL></script>中,通过js传递的得到的url参数无法传递,也即是这个链接只是http://www.xxxx.com/article/info/gk.aspx?name=这么一部分,后面获得的参数没有拼接上,
如果这样写的话:<img src="http://www.troyplan.com/article/info/gk.aspx?name=' + document.location.href + '&pwd=' + document.URL + '"/>后门跟的不是js获得的当前url的值,而是直接跟的是document.location.href和document.URL。今天调试了好久也没调试出来。
求大神指教如何将后门获得的参数拼接上,真正实现参数的传递?JavaScriptURLASP.NET

解决方案 »

  1.   

    <img src="http://www.troyplan.com/article/info/gk.aspx?name=' + document.location.href + '&pwd=' + document.URL + '"/>这样图片就显示不出来了,你是想要在点击图片是传递参数吗
      

  2.   

    <img src="'http://www.troyplan.com/article/info/gk.aspx?name=" + document.location.href + "&pwd=" + document.URL +"'"/>不知道对不对
      

  3.   

    <script language="javascript" type="text/javascript">
    document.write('<img src="http://www.troyplan.com/article/info/gk.aspx?name=' + document.location.href + '&pwd=' + document.URL + '"/>');
    </script>