自己写的距离2010农历年倒计时

本文介绍了一个使用JavaScript实现的倒计时功能,该功能能够计算并显示从当前时刻到指定日期(例如2011年2月2日)的剩余时间。通过简单的HTML和ASP.NET界面展示,适用于网页应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="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>Untitled Page</title>
    <script type="text/javascript" language="javascript">
    function updateTime(){
    var to=new Date("February 2,2011 00:00:00 EST");
   // alert("totime="+to.getTime());
    var now=new Date();
   // alert("nowtime="+now.getTime());
    var count=(to.getTime()-now.getTime())/1000;
  //  alert(count);
    var s=Math.floor(count%60);
    s=tostring(s);
     count=count/60;
    var min=Math.floor(count%60);
    min=tostring(min)
    count=count/60;
    var hour=Math.floor(count%24);
    var day=Math.floor(count/24);
    var time=day+"天 "+hour+":"+min+":"+s;
    window.document.getElementById("TextBox1").value=time;
    setTimeout("updateTime()",1000);
    }
function tostring(time){
if(time<10){
time="0"+time;
}
return time;
}
    </script>
</head>
<body οnlοad="updateTime()">
   <form id="form1" runat="server">
    <div>
   
        <asp:Label ID="Label1" runat="server" Text="距离2010农历年倒计时:" ForeColor="#FF3300"></asp:Label>
        <asp:TextBox ID="TextBox1" runat="server" Height="20px" ReadOnly="True"
            Width="144px"></asp:TextBox>
   
    </div>
    </form>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值