两行代码:
{
    this.Response.Write("<script>alert('Hello, world!');</script>");
    this.Response.Redirect("~/Index.aspx");//当前页不是Index.aspx
}在实际执行时,第一行是无效的,请问应如何才能在第一行弹出的对话框被用户确定后,再执行第二行的跳转?

解决方案 »

  1.   

    this.Response.Write(" <script>alert('Hello, world!');window.location.href='Index.aspx'</script>"); 
    都用js 实现就可以了
      

  2.   

    Response.Write("<script lanuage=javascript>alert('Hello,World!');location.href=('~/Index.aspx');</script>");
      

  3.   

    <script>
    function chk()
    {
    if(confirm("真的要跳转?")){window.location="http://www.qq.com";}
    }
    </script>
    <a href="#" onclick="chk();">test</a>
      

  4.   


            Response.Write("<script>alert('Hello, world!');window.location.href='~/Index.aspx';</script>");//转页面路径要写对
      

  5.   

    Response.Write("<script>alert('操作成功!');window.location.href='你要跳转的页面';</script>");
      

  6.   

    <script> 
    function chk() 

    if(confirm("真的要跳转?")){window.location="http://www.qq.com";} 

    </script> 
    <a href="#" onclick="chk();">test </a>
    用模式对话框吧~
      

  7.   


    this.Response.Write(" <script>alert(操作成功!');window.location.href='Index.aspx' </script>"); 
      

  8.   

    Response.Write("<script>alert('Hello, world!');location.href='Index.aspx';</script>");
    这样就可以了啊。
      

  9.   

    感觉楼主明白一点就好了,你输出的js虽然会alert,但是那是客户端的浏览器来解释弹出的,而Response.Redirect在服务器端就给你搞了,所以根本轮不到js来alert
      

  10.   

    Response.Write(" <script>alert('Hello, world!');window.location.href="YourUrl"; </script>")
      

  11.   

    大家都这么热情,我也不能落下,<script>alert('Hello, world!'); 和 Response.Redirect是不能一起使用的,记得啊!!呵呵
      

  12.   

    Response.Write(" <script>alert('操作成功!');window.location.href='你要跳转的页面'; </script>");
      

  13.   

    To Lz,跳转的页面有带"~"路径的,js无法识别它吧!