zoukankan      html  css  js  c++  java
  • 简陋时钟

    1:charAt() 方法可返回指定位置的字符。

    2:获取时间:getHours(),getMinutes(),geFullYear(),getDay()(返回星期几,0-6),getDate(),getMouth()(0-11)

     1 <!doctype html>
     2 <html>
     3 <head>
     4     <meta charset="UTF-8">
     5     <script type="text/javascript" >
     6     //将单位数转换成双位
     7     function toDouble(num){
     8         if(num<10)
     9             return '0'+num;
    10         else
    11             return num;
    12     }
    13     //更新时间
    14     function timeUpdate(){
    15         var oDate=new Date();
    16         var imgS=document.getElementsByTagName('img');
    17         var str=''+toDouble(oDate.getHours())+toDouble(oDate.getMinutes())+toDouble(oDate.getSeconds());
    18         var i=0;
    19         for(i=0;i<imgS.length;i++)
    20         {
    21             imgS[i].src="images/"+str.charAt(i)+".png";
    22         }
    23     }
    24     window.onload=function(){
    25         //设置定时器,每一秒更新一次,但若只是这样,会在页面加载1s后才更新时间
    26         setInterval(timeUpdate,1000);
    27         //页面一加载就调用更新函数,因此不会有1s延迟
    28         timeUpdate();
    29 
    30     };
    31     </script>
    32     <style>
    33     body{
    34         background-color:orange;
    35         font-size:30px; 
    36     }
    37     </style>
    38 </head>
    39 <img src="images/0.png">
    40 <img src="images/0.png">
    41 42 <img src="images/0.png">
    43 <img src="images/0.png">
    44 45 <img src="images/0.png">
    46 <img src="images/0.png">
    47 48 <body>
    49 </body>
    50 </html>

  • 相关阅读:
    OSCP Learning Notes Buffer Overflows(3)
    OSCP Learning Notes Buffer Overflows(5)
    OSCP Learning Notes Exploit(3)
    OSCP Learning Notes Exploit(4)
    OSCP Learning Notes Exploit(1)
    OSCP Learning Notes Netcat
    OSCP Learning Notes Buffer Overflows(4)
    OSCP Learning Notes Buffer Overflows(1)
    OSCP Learning Notes Exploit(2)
    C++格式化输出 Learner
  • 原文地址:https://www.cnblogs.com/l0520/p/6809865.html
Copyright © 2011-2022 走看看