.NET倒计时

转自:http://blog.sina.com.cn/s/blog_66f7fa5a0100tihx.html

 

aspx页面:

 <br>距结束时间还有<br>
<span id="span_dt_dt" style='border:1px solid black;background-color:#FFFFFF' ></span>

<SCRIPT type="text/javascript">
<!--
//document.write("");
var timess='<asp:Literal ID="timess" runat="server"></asp:Literal>'
function show_student163_time(){
 window.setTimeout("show_student163_time()", 1000);
 BirthDay=new Date(timess);
 today=new Date();
 timeold=(BirthDay.getTime()-today.getTime());
 sectimeold=timeold/1000
 secondsold=Math.floor(sectimeold);
 msPerDay=24*60*60*1000
 e_daysold=timeold/msPerDay
 daysold=Math.floor(e_daysold);
 e_hrsold=(e_daysold-daysold)*24;
 hrsold=Math.floor(e_hrsold);
 e_minsold=(e_hrsold-hrsold)*60;
 minsold=Math.floor((e_hrsold-hrsold)*60);
 seconds=Math.floor((e_minsold-minsold)*60);
 span_dt_dt.innerHTML=daysold+"天"+hrsold+"小时"+minsold+"分"+seconds+"秒" ;

}
show_student163_time();
//-->
</SCRIPT>

aspx.cs页面

  protected void Page_Load(object sender, EventArgs e)
    {
        this.timess.Text = "12:10 05-6-2011";//可以动态查出所到期的时间
    }

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值