zoukankan      html  css  js  c++  java
  • 时间

    
    
    <!doctype html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>北京时间</title>
    </head>
    <style>
        *{
            margin: 0;
            padding: 0;
            list-style: none;
            color: red;
        }
        #time{
            width: 800px;
            height: 100px;
            line-height: 100px;
            font-size: 30px;
            font-family: "微软雅黑";
            position: absolute;
            margin: auto;
            left: 0;
            top: 0;
            right: 0;
            bottom: 0;
            background: rgba(0,0,0,0.4);
            box-shadow: 0px 0px 10px #000;
            text-align: center;
        }
    </style>
    <body>
        <div id="time">现在是北京时间:</div>
    </body>
    <script>
        window.onload = function(){
            times();
            function times(){
                showTime();    
                function minSecond(i){
                    if(i<10){
                        i = "0" + i; 
                    }
                    return i;
                }
                function showTime(){
                    var bjtime = new Date();
                    var bjyear = bjtime.getFullYear();
                    var bjmonth = bjtime.getMonth()+1;
                    var bjday = bjtime.getDate();
                    var week = bjtime.getDay();
                    var hours = bjtime.getHours();
                    var min = bjtime.getMinutes();
                    var seconds = bjtime.getSeconds();
                    min = minSecond(min);
                    seconds = minSecond(seconds);
                    var weekday = ["","","","","",""];
                    
                    document.getElementById("time").innerHTML ="现在是北京时间:" + bjyear +"年-"+ bjmonth +"月-"+ bjday +"日-" + "星期" + weekday[week] + "-" + hours +":" + min +":"+ seconds  ;
                    setInterval(showTime,1000);
                }
            }
        }
    </script>
    </html>
    
    
    
     
  • 相关阅读:
    VC++删除浮动工具条中“关闭”按钮
    automation无法创建对象
    SQL Server 不产生日志
    收缩数据文件
    VB DoEvents用法
    Sql Server添加用户
    Winsock错误代码一览表
    监控数据库性能的sql
    数据库日志文件清理脚本
    VB 中资源文件的多种使用技巧
  • 原文地址:https://www.cnblogs.com/mymission/p/5857474.html
Copyright © 2011-2022 走看看