• csharp webform Button控件OnClick,OnClientClick事件


    代码
     1 <html xmlns="http://www.w3.org/1999/xhtml" >
     2 <head runat="server">
     3     <title>csharp webform Button控件OnClick,OnClientClick事件</title>
     4     <script language="javascript" type="text/javascript">
     5 function confirmthis()
     6 {
     7 if(confirm("Do you want to do a server trip?"))
     8 {
     9 return true;
    10 }
    11 else
    12 {
    13 return false;
    14 }
    15 }
    16 </script>
    17 </head>
    18 <body>
    19     <form id="form1" runat="server">
    20     <div>
    21         <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    22      <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button"  OnClientClick="return confirm('審批後將不能再修改,您確認審批嗎?')"/>
    23         <br />
    24         <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
    25         <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Button" OnClientClick="return confirmthis();"/></div>
    26     </form>
    27 </body>
    28 </html>
    29 
    30  
    31 
    32     public partial class button : System.Web.UI.Page
    33     {
    34         protected void Page_Load(object sender, EventArgs e)
    35         {
    36 
    37         }
    38         protected void Button1_Click(object sender, EventArgs e)
    39         {
    40             this.TextBox1.Text = "click me";
    41         }
    42 
    43         protected void Button2_Click(object sender, EventArgs e)
    44         {
    45             this.TextBox2.Text = "Do you want to do a server trip";
    46         }
    47     }
    48 
  • 相关阅读:
    爬虫时http错误提示
    json.dumps()和json.loads()
    scrapy框架原理学习
    利用tushare进行对兴业银行股价的爬取,并使用numpy进行分析
    随机生成60位同学成绩,并求他们的平均数,中位数,众数等
    numpy中random的使用
    matplotlib中subplot的使用
    使用matplotlib画饼图
    乔坟,乔坟!
    c#控件的动画显示效果
  • 原文地址:https://www.cnblogs.com/geovindu/p/1809199.html
Copyright © 2020-2023  润新知