protected void login_Click(object sender, ImageClickEventArgs e)
    { 
            if (b == a)
            {
               Server.Transfer("Index.aspx");
            }
            else
            {
               Response.Write("<script language=javasript>alert('密码错误')<"+"/script>");
            }
     }
为什么此处不会跳出弹窗

解决方案 »

  1.   

    你最好使用
    Page.ClientScript.RegisterStartupScript(Page.GetType(), "ks", "alert('密码错误')", true);
    另外,条件满足了啊
      

  2.   


     protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
             if (0 == RebootAXIS(MachineIp.Ip))
            {
                //MessageBox.Show("Reboot successfully.");
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "ks", "alert('Reboot successfully.')", true);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "ks", "alert('Failed to reboot the DVS.')", true);
            } 
            
        }
    使用了 但是还是不跳出来  
      

  3.   

    是不是浏览器block了弹出窗口?
      

  4.   

     1、Response.Write("<script>alert('密码错误')</script>");
    2、Page.ClientScript.RegisterStartupScript(this.GetType(),"","alert('密码错误')",true);
    这2个都可以。你调试下,是不是条件没满足?没有执行
      

  5.   

    另外页面是什么?使用了UpdatePanel?
      

  6.   


    老大,知道了,这样就可以了
    ScriptManager.RegisterStartupScript(this.btnOK, this.GetType(), "alert", "alert('添加信息成功!');", true);
      

  7.   

    使用了UpdatePanel,得使用这种方式
    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('123');", true);