zoukankan      html  css  js  c++  java
  • js 钟表

     1 <script>
     2 document.write('<TR><td colspan="3" align="right" bgcolor="#C6C3C6" valign="bottom">');
     3 document.write('<font class="whiteword"><b>现在时间</b></font></td><td valign="bottom" colspan="4" bgcolor="#C6C3C6">');
     4 document.write('<div id="clock" class="clock"></div>');
     5 document.write('</TD>');
     6 </script>
     7 
     8 <script LANGUAGE="JavaScript">
     9 
    10 var timerID = null;
    11 var timerRunning = false;
    12 function stopclock (){
    13 
    14 if(timerRunning)
    15 clearTimeout(timerID);
    16 timerRunning = false;
    17 
    18 
    19 }
    20 
    21 function showtime () {
    22 var now = new Date();
    23 var hours = now.getHours();
    24 var minutes = now.getMinutes();
    25 var seconds = now.getSeconds();
    26 var timeValue = " " + ((hours <10) ? "0" :"")+hours;
    27 timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
    28 timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
    29 document.getElementById("clock").innerHTML=timeValue;
    30 timerID = setTimeout("showtime()",1000);
    31 timerRunning = true;
    32 }
    33 function startclock () {
    34 stopclock();
    35 showtime();
    36 }
    37 
    38 </script>
    39 <script language="javascript">
    40 
    41 startclock();
    42 </script>
    白发三千丈
  • 相关阅读:
    bzoj4974: [Lydsy1708月赛]字符串大师
    bzoj1801: [Ahoi2009]chess 中国象棋
    predis的使用
    常用的文件数据类型mime
    使用CURL模拟表单上传文件
    模型类:连接数据库
    extends注意事项
    extends前提
    include
    radio后的input框数据传递
  • 原文地址:https://www.cnblogs.com/sanpoye/p/2541283.html
Copyright © 2011-2022 走看看