复制代码 代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="动态显示实时时间._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>动态显示实时时间</title>
<style type="text/css">
.style1
{
height: 183px;
}
</style>
</head>
<body>
<form runat="server">
<div> <asp:ScriptManager runat="server">
</asp:ScriptManager>
</div>
<table>
<tr>
<td>动态显示实时时间</td>
</tr>
<tr><td><asp:UpdatePanel runat="server" >
<ContentTemplate>
当前时间是:
<asp:Label runat="server" Text="Label"></asp:Label>
<asp:Timer runat="server" Interval="1000">
</asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>
</td></tr>
</table>
</form>
</body>
</html>
复制代码 代码如下:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace 动态显示实时时间
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToString();
}
}
}
新闻热点
疑难解答
图片精选