zoukankan      html  css  js  c++  java
  • 倒计时 服务器时间 .NET js javascript

    原文发布时间为:2011-02-07 —— 来源于本人的百度文章 [由搬家工具导入]

    <!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>服务器时间倒计时</title>
    </head>
    <body>
    <span id="time"></span>
    <script language="javascript">
        var SysSecond = 3600; //服务器距离现在的秒数,用aspx的服务器时间可以写成 var SysSecond =<%=Math.Floor((DateTime.Parse("2012/12/20 12:12:12") - DateTime.Now).TotalSeconds) %>
         function setRemainTime() {
            if (SysSecond > 0) {
                SysSecond = SysSecond - 1;
                var second = Math.floor(SysSecond % 60).toString();
                var minite = Math.floor((SysSecond / 60) % 60).toString();
                var hour = Math.floor((SysSecond / 3600) % 24).toString();
                var day = Math.floor((SysSecond / 3600) / 24).toString();
                document.getElementById("time").innerHTML=day + "天" + hour + "小时" + minite + "分" + second + "秒";
            } else {
                return;
            }
        }
        window.setInterval(setRemainTime, 1000);
    </script>

    </body>
    </html>

  • 相关阅读:
    thinkphp empty标签
    thinkphp present标签
    if标签
    thinkphp 范围标签
    thinkphp 比较标签
    thinkphp switch标签
    thinkphp for标签
    thinkphp foreach标签
    QueryList 来做采集
    thinkphp volist标签
  • 原文地址:https://www.cnblogs.com/handboy/p/7163928.html
Copyright © 2011-2022 走看看