index.htm页面<script type="text/javascript" src="CommentVote.aspx?modelID=111"></script>传值,在CommentVote.aspx页面如何得到该值,如何把CommentVote.aspx页面的html代码再返回到index.htm页面

解决方案 »

  1.   

       <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="CommentVote.aspx?modelID=111">HyperLink</asp:HyperLink>接收:string s=  Request.QueryString["modelID"];
        
      

  2.   

    前面页面为html页面,<asp:HyperLink>不能用啊
      

  3.   

    var script = document.createElement("script");
    script.type = "text/javascript";
    script.src = "CommentVote.aspx?modelID=111";
    document.body.appendChild(script);然后在后台返回的一定要是这样的
    var a = "..."
      

  4.   

    index.html<script type="text/javascript" >
    function Go()
    {
      window.location="CommentVote.aspx?modelID=111";
    }
    Go();
    </script>然后在CommentVote.aspx页面中这样获取参数: string Str=Request.QueryString["modelID"].ToString();在CommentVote.aspx页面转向index.html: Response.Redict("index.html");
      

  5.   

    或者试用xmlHttpRequest来请求
    因为我看你并没有跨域,这样做并没有必要
      

  6.   

    在CommentVote.aspx页面我该如何得到这个值呢,并且这是怎么跳转到CommentVote.aspx页面的
      

  7.   

    <script type="text/javascript" src="CommentVote.aspx?modelID=111"></script>
    src只能写js文件的路径吧
      

  8.   

    获取参数用Request.QueryString["modelID"]就行了,CommentVote.aspx里返回的数据都将作为Javascript在index.html中被引用(最好放在head中)。
    所以CommentVote.aspx里应该直接把默认添加的Xhmtl都去掉,直接写JS(连<script />都不需要了。
    也可以用<%Request.QueryString["modelID"]%>写服务端代码,或者在.cs中Response.Write()输出JS如何返回到index.html?要么你在CommentVote.aspx中输出JS对象,比如文本或者Json对象,然后在index.html中调用函数,或者直接给到某个html控件上function myReturn(){
      document.getElementById("txt_name").value = "指定的值";
    }在index.html中,直接调用myReturn()就好了,你还可以带参数。
    或者利用Ajax异步调用
      

  9.   

    是没有跨域,想要的需求就是在html页面传一个新闻ID给aspx页面,然后在aspx页面中对此新闻做一个心情评论插件
      

  10.   

    取值会了啊LZ是不是想做类似点击数的功能啊
    index.htm页面<script type="text/javascript" src="CommentVote.aspx?modelID=111"></script>
    就只留下这一句话别的删除看看呢
      

  11.   

    其实你那个应该是弄错了。想传数到另一个页面(例如a.aspx),要么就是
    服务器端用:response.redirect("a.aspx?name=xxx");
    客户端用:window.locatioin.href("a.aspx?name=xxx");
    接收的话就是:string a=Request.QueryString["name"];
    客户端跟服务器端还是有一点点差别的;你可以再后面加上一个
    Response.write("<script>alert(\"a\")</script>");试试效果就知道了;
    我可是纯手工打出来的哦!楼主觉得好的话,记得给我分哦!
      

  12.   

     CommentVote.aspx这个页面这样输出就行了:Response.Write("document.write('" + voteNumber + "');");还有就是index.html引用时最好加charset="gb2312",<script type="text/javascript" src="CommentVote.aspx?modelID=111" charset="gb2312">
      

  13.   

    补充一点CommentVote.aspx页面,要删除所有HTML代码