在页面上显示的是服务器的时间
解决方案 »
- RowUpdating取不到最新值
- 已有打开的与此命令相关联的DataReader,必须首先将它关闭
- 如何用CSS来实现鼠标经过图像凸起?
- 急呀!帮帮忙啦,高手们---关于用VB.net发送Email的问题,
- 关于datagrid的简单问题:(
- XML文件读取时出现权限不足的问题,请教高手~~~~~~
- 如何定时刷新页面
- Menu控件判断ChildItems是否包含MenuItem
- Socket接收中文汉字出现乱码?
- 怎么去除textbox中录入的非法字符,如单引号'、<a>之类的标签等等....
- 动态导航栏高手指教!
- look for code if "pragmatic ajax - a primer web 2.0"
<!--
'Add By zhaofeng on 2005-01-07
Dim strServerTime
Dim sClientTime
Dim iSecondDiff '//服务器时间与客户端时间的差(秒)
strServerTime = "<%=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")%>"
sClientTime = Now()
iSecondDiff = DateDiff("s",sClientTime,strServerTime)
ShowCurrentTime()
function ShowCurrentTime()
Dim curTime
curTime = DateAdd("s",iSecondDiff,Now)
Dim strTime
strTime = FormatDateTime(curTime,1) & FormatDateTime(curTime,3)
strTime = strTime & " " & WeekdayName(Weekday(curTime),0)
'alert(strTime)
document.getElementById("div1").innerText = strTime
window.setTimeout "ShowCurrentTime()", 1000
end function
'Add End
//-->
</SCRIPT>
label.text = datetime.now(),触发时间可以写1000毫秒,这个可以自己定,ajax非常容易实现。
如果要显示服务器时间,则使用DataTime.Now时间 ,对于时间以秒变化显示有两种方案:一种是使用System.Threading.Timer创建定时线程,第二种方案结合使用asp.net ajax的 UpdatePanel和UpdateProgress控件