zoukankan      html  css  js  c++  java
  • 界面显示时间

     1 <html>
     2 <body>
     3 <script type="text/javascript">
     4 function showTime() {
     5     "use strict"
     6     var temp_CurrentTime = document.getElementById('temp_CurrentTime');
     7     if(!temp_CurrentTime){
     8         var show = document.createElement('div');
     9         show.setAttribute('id','temp_CurrentTime');
    10         document.body.appendChild(show);
    11         temp_CurrentTime = document.getElementById('temp_CurrentTime');
    12     } 
    13     var currentTime = new Date;
    14     var hours =  currentTime.getHours();
    15     if(hours < 10) {
    16             hours = '0' + hours;    
    17         }
    18         var minutes = currentTime.getMinutes();
    19         if(minutes < 10) {
    20             minutes = '0' + minutes;    
    21         }
    22         var seconds = currentTime.getSeconds();
    23         if(seconds < 10) {
    24             seconds = '0' + seconds;    
    25         }
    26         temp_CurrentTime.innerHTML =     currentTime.getFullYear() + '' + (currentTime.getMonth() + 1)
    27  + '' + currentTime.getDate() + '' + ' ' + hours + '' + minutes + '' + seconds;    
    28      }
    29     
    30     window.onload = function() {
    31         setInterval('showTime()',1000);    
    32     }
    33 </script>
    34 
    35 </body>
    36 </html>
  • 相关阅读:
    I-Cache和D-cache
    socat使用
    反射
    属性方法
    getitem
    文件打开编辑和函数参数
    python3编码问题个人理解
    正文内容 python3编码问题
    进度条制作
    集合关系
  • 原文地址:https://www.cnblogs.com/jianxie/p/2670381.html
Copyright © 2011-2022 走看看