发现下面语句不弹出对话框:
Response.Write("<script>alert('........');</script>");
Response.Redirect("WebForm35.aspx");怎样才能弹出对话框后在转页?
谢谢

解决方案 »

  1.   

    主要是你的脚本有问题:请改成下面这样的:
    Response.Write("<script language='javascript'>alert('........')</script>");
      

  2.   

    Response.Write("<script language='javascript'>alert('........');window.location='WebForm35.aspx'</script>");
      

  3.   

    Response.Write(@"<script>
                       alert('........');
                       window.open("WebForm35.aspx","_self");
                     </script>");
    就可以了,注意"_self".
      

  4.   

    <script>
    function aa()
    {
    alert("转到2.aspx页");
    document.location.href='2.aspx';
    </script><input type=button value="redirect" onclick=aa()>
      

  5.   

    Response.Write("<script>alert('........');location='WebForm35.aspx'</script>");
      

  6.   

    <script>alert('........');location='WebForm35.aspx'</script>
    的确是个好方法,但是我的弹出框是有条件的

    if(条件)
    {
      Response.Write("<script>alert('........');</script>");
    }
    else
    {
      //do nothing
    }
    Response.Redirect("WebForm35.aspx");这样怎么改?
    如果改成Response.Write("<script>alert('........');location='WebForm35.aspx'</script>");
    则,无论如何都会弹出对话框声明,不想用变量或session 来标示  条件  是否成立
    再等
      

  7.   

    Response.Write("<script>if (confirm('........'))location='WebForm35.aspx'</script>");
      

  8.   

    if(条件)
    {
      Response.Write("<script>alert('');location='WebForm35.aspx'</script>");
    }
    else
    {
      Response.Redirect("WebForm35.aspx");
    }