现在的位置: 首页 > 综合 > 正文

点击按钮可能执行的操作总结

2014年03月15日 ⁄ 综合 ⁄ 共 996字 ⁄ 字号 评论关闭

对于Html的Input(Button)控件,当点击执行的可能执行的情况:

 function BtnClick()
    {
       //打开一个新窗体
       //window.open("2.aspx","_self","",true);
       //弹出一个新窗体
       window.open("2.aspx","_blank","menubar=0,left = 20,top = 30,height=500,width=500");
       //弹出一个只有确认按钮的提示
       //alert("请输入一个正数!");
       //关闭窗体时弹出提示信息
      // if(confirm("确定退出?")==true)
      // {window.opener=null;window.close();}
    }
    </script>

<input id="BTNINPUT" type="button" onclick = "BtnClick()" value="测试html(input_button)" />

对于服务器端的标准控件,当点击执行的可能执行的情况:

 <asp:Button ID="BtnServer" runat="server" OnClick="Button1_Click" Text="测试Server(button)" />

protected void Button1_Click(object sender, EventArgs e)
    {
        //1: 打开新的窗体
       // Response.Redirect("2.aspx");
        //2: 弹出一个新窗体
       // Response.Write("<script>window.open(/"2.aspx/")</script>");
        //3: 弹出一个只有确定按钮的提示信息
        //   Response.Write("<script>alert(/"请输入一个正数!/");</script>");
        //4: 关闭窗体时弹出提示信息
        Response.Write("<script>if(confirm(/"确定退出?/")==true){window.opener=null;window.close();}</script>");
    }

 

 

抱歉!评论已关闭.