各位.NET大侠们,在下问个问题我又个表TimeListId Time
1 2009-8-25 0:00:00我想做个倒计时功能,从此时到数据库中 (2009-8-25 0:00:00)的倒计时功能,在下.net初学者,请高手们告诉下,最好有代码。谢谢!
1 2009-8-25 0:00:00我想做个倒计时功能,从此时到数据库中 (2009-8-25 0:00:00)的倒计时功能,在下.net初学者,请高手们告诉下,最好有代码。谢谢!
B/S就要用JAVASCRIPT了
C/S比較簡單。
webform javascript setTimeout
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
var TotalMinutes = 5;
var TotalMilliSeconds = 5*60*1000;
function takeCount()
{
//计数减一
TotalMilliSeconds -= 1000;
//计算时分秒
var hours = Math.floor( TotalMilliSeconds / ( 1000 * 60 * 60 )) % 24;
var minutes = Math.floor(TotalMilliSeconds / (1000 * 60)) % 60;
var seconds = Math.floor(TotalMilliSeconds / 1000) % 60;
//将时分秒插入到html中
document.getElementById("RemainH").innerHTML = hours;
document.getElementById("RemainM").innerHTML = minutes;
document.getElementById("RemainS").innerHTML = seconds;
window.setTimeout("takeCount()",1000);
}
</script></head>
<body>
<form id="form1" runat="server">
<div>
<div id="CountMsg">
倒计时还有:
<strong id="RemainD"></strong><strong id="RemainH">XX</strong>时
<strong id="RemainM">XX</strong>分
<strong id="RemainS">XX</strong>秒
<input id="Button1" type="button" value="button" onclick="takeCount()"/>
</div>
</div>
</form>
</body>
</html>