zoukankan      html  css  js  c++  java
  • js实现计时

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="UTF-8">
            <title>表单</title>
        </head>
        <body>
            <div id="clock">
                
            </div>
        </body>
        
        <script>
        function realSysTime(clock)
            {
                var now = new Date();
                var year = now.getFullYear();
                var moth = now.getMonth();
                var date1 = now.getDate();  //获取日
                var day = now.getDay();
                var hour = now.getHours();
                var minute = now.getMinutes();
                var sec = now.getSeconds();
                moth+=1;
                var arr_week = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
                var week = arr_week[day];
                var time = year+"年"+moth+"月"+date1+"日 "+week+" "+hour+":"+minute+":"+sec;  //组合系统时间
                clock.innerHTML="当前时间:"+time;
            }
            window.onload=function(){
                window.setInterval("realSysTime(clock)",1000);
            }
        </script>
    </html>

  • 相关阅读:
    poj 3243 Clever Y(BabyStep GiantStep)
    poj 2417 Discrete Logging
    poj 3481 Double Queue
    hdu 4046 Panda
    hdu 2896 病毒侵袭
    poj 1442 Black Box
    hdu 2815 Mod Tree
    hdu 3065 病毒侵袭持续中
    hdu 1576 A/B
    所有控件
  • 原文地址:https://www.cnblogs.com/nanfengnan/p/13941463.html
Copyright © 2011-2022 走看看