zoukankan      html  css  js  c++  java
  • Day3-----clock

    //------------------------通过获取系统时间,添加定时器和添0操作完成日期和时间的显示

    <html>
    <head><title>clock</title></head>
    <style type="text/css">
    body{font-size: 25px;vertical-align: top;}
    </style>
    <script type="text/javascript">
    function addZero(str){
    if(str<10) return '0'+str;
    else return str;
    }
    function updateTime(){
    var date=new Date();
    oImg=document.getElementsByTagName('img');
    var str=''+date.getFullYear()+addZero((date.getMonth()+1))+addZero(date.getDate())+date.getDay()+addZero(date.getHours())+addZero(date.getMinutes())+addZero(date.getSeconds());
    for(i=0;i<oImg.length;i++){
    oImg[i].src="pic/"+str[i]+".png";
    }
    }
    window.onload=function(){
    updateTime();
    setInterval(updateTime,1000);
    }
    </script>
    <body>
    <img><img><img><img>/
    <img><img>/
    <img><img>
    The <img>th
    <br/>
    <img><img>:
    <img><img>:
    <img><img>
    </body>
    </html>

  • 相关阅读:
    tensorflow实践学习一
    计算CPU的MIPS
    计算机原理一
    SecureCRT连接虚拟机失败及虚拟机ping不通外网
    03.os
    02.random
    01.time
    01.面试过程中其他问题
    06.秒杀系统架构
    05.项目并发分析
  • 原文地址:https://www.cnblogs.com/fleshy/p/4114978.html
Copyright © 2011-2022 走看看