<asp:ScriptManager ID="ScriptManager_Time" runat="server" />
<asp:UpdatePanel ID="UpdatePanel_Time" runat="server">
<ContentTemplate>
<asp:Timer ID="SystemTime" runat="server" Interval="1000" OnTick="SystemTime_Tick"></asp:Timer>
<asp:Label ID="LabelTime" runat="server" Text="" ForeColor="#037A74" Font-Bold="true"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
protected void Page_Load(object sender, EventArgs e)
{
LabelTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
protected void SystemTime_Tick(object sender, EventArgs e)
{
LabelTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
利用 Timer 控件在页面上显示实时时间
最新推荐文章于 2023-05-09 11:30:46 发布