zoukankan      html  css  js  c++  java
  • ASP.NET网站中实现实时时间

    方法一:
    运用AJAX:

     <%--显示实时时间--%>
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                <%--lable控件必须和Timer控件放在一起--%>
                    <asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick1">
                    </asp:Timer>
                    <asp:Label ID="Label1" runat="server" Width="220px"></asp:Label>
                    <br />
                </ContentTemplate>
            </asp:UpdatePanel>
    

    在aspx文件中添加代码:

     protected void Timer1_Tick1(object sender, EventArgs e)
        {
            //当前时间
            Label11.Text = DateTime.Now.ToString(); 
        }
    
  • 相关阅读:
    Title
    Title
    Title
    Title
    Title
    Title
    Title
    Title
    Title
    git 的使用
  • 原文地址:https://www.cnblogs.com/LJF111/p/12304847.html
Copyright © 2011-2022 走看看