Response.Write("<script>alert('注册成功')</script>");
Response.Redirect("../Qw_infodetail.aspx?fr_id="+Session["fr_id"].ToString());如上,为什么有了Response.Redirct 后
Response.Write("<script>alert('注册成功')</script>");就不执行了,也就是不弹出注册成功的确认窗口了。另外有办法使得Response.Redirect是弹出新窗口吗?

解决方案 »

  1.   

    Response.Write("<script>alert('注册成功');
    window.location.href='../Qw_infodetail.aspx?fr_id="+Session["fr_id"].ToString()+"'"
    </script>");
      

  2.   

    执行这个Response.Redirect这个以后,当前的线程就中止了,他会重新定向到一个新页面,所以原来Write的东西就没有了。
    你可以考虑传递参数到Qw_infodetail.aspx页面里面,在这个页面alert。==》另外有办法使得Response.Redirect是弹出新窗口吗?
    Response.Write("<script>window.open(....)</script>");
      

  3.   

    同意一楼
    服务端代码先执行,所以只能用输出的javascript执行转向
      

  4.   

    Response.Redirect是在服务器端执行的,而Response.Write只是输出客户端代码而已。
    正确的做法:
    Response.Write("<script>alert('注册成功')</script>");
    Response.Write("<script>window.location.href='../Qw_infodetail.aspx?fr_id="+Session["fr_id"].ToString()+"'"
    </script>");
      

  5.   

    用这个Response.Write("<script>window.open(....)</script>");来执行,会被屏蔽的