2008北京奥运会倒计时

marginwidth="0" marginheight="0" src="http://218.16.120.35:65001/PC/Global/images/b.html" frameborder="0" width="728" scrolling="no" height="90">

<!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>
  <title>2008北京奥运会倒计时@阿良.NET</title>
  <meta name="generator" content="editplus" />
  <meta name="author" content="" />
  <meta name="keywords" content="" />
  <meta name="description" content="" />
  <script type="text/javascript">
/*版权所有阿良.NET
http://www.chenjiliang.com/Article/View.aspx?ArticleID=3465&TypeID=31*/
window.onload = OlympicCountdown;
function OlympicCountdown()
{
    var futureDate = new Date(2008, 7, 8, 20);//开幕时间注意8月要减1,所以是7
    var messageExceedTime="2008北京奥运会已经开幕";
    var message = Countdown(futureDate, messageExceedTime);
    document.getElementById("OlympicCountdownDiv").innerHTML = message;
   
    if (message == messageExceedTime)
        return;
   
    setTimeout("OlympicCountdown()", 1000);
}

//倒计时,如果超出将来日期,返回messageExceedTime;否则返回倒计时间
function Countdown(futureDate, messageExceedTime)
{
    var now = new Date();
    if (now >= futureDate)
    {
//        alert(messageExceedTime);
        return messageExceedTime;
    }
   
    var days = 0;
    var hours = 0;
    var minutes = 0;
    var seconds = 0;
   
    var total = futureDate.getTime() - now.getTime();
    var x = 24 * 60 * 60 * 1000;
    days = total / x;
    days = Math.floor(days);
   
    total = total % x;
    x = 60 * 60 * 1000;
    hours = total / x;
    hours = Math.floor(hours);
   
    total = total % x;
    x = 60 * 1000;
    minutes = total / x;
    minutes = Math.floor(minutes);
   
    total = total % x;
    x = 1000;
    seconds = total / x;
    seconds = Math.floor(seconds);
   
    var message = "";
    if (days > 0)
        message += days + "天";
       
    if (hours > 0)
        message += hours + "小时";
    else
    {
        if (message != "")
            message += "0小时";
    }
        
    if (minutes > 0)
        message += minutes + "分";
    else
    {
        if (message != "")
            message += "0分";
    }
        
    if (seconds > 0)
        message += seconds + "秒";
    else
    {
        if (message != "")
            message += "0秒";
    }
     
//    alert(message);
    return message;
}
</script>
<style type="text/css">

body
{
text-align:center; font-weight:bold; font-family:verdana; font-size:38px;
}

</style>
</head>
<body>
<p>
2008北京奥运会倒计时
<p>
离2008-8-8 20:00还有
</p>
</p>
<div id="OlympicCountdownDiv">
</div>

</body>
</html>
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值