zoukankan      html  css  js  c++  java
  • javascript显示年月日时间代码显示电脑时间

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <title>显示当前北京时间</title>
        <script language=Javascript>
        function time() {
            //获得显示时间的div
            t_div = document.getElementById('showtime');
            var now = new Date()
                //替换div内容 
            t_div.innerHTML = "现在是" + now.getFullYear() + "" + (now.getMonth() + 1) + "" + now.getDate() + "" + now.getHours() + "" + now.getMinutes() + "" + now.getSeconds() + "";
            //等待一秒钟后调用time方法,由于settimeout在time方法内,所以可以无限调用
            setTimeout(time, 1000);
        }
        </script>
    </head>
    
    <body onload="time()">
        <div id="showtime"></div>
    </body>
    
    </html>

    效果图:

  • 相关阅读:
    linux中apt-get使用
    部署ceph
    cinder存储服务
    ceph简介
    Horizon Web管理界面
    neutron网络服务2
    neutron网络服务
    nova计算服务
    cinder存储服务
    keystone身份认证服务
  • 原文地址:https://www.cnblogs.com/huanghuali/p/7067816.html
Copyright © 2011-2022 走看看