javascriptはリアルタイムの時間を表示します.

672 ワード

<html>
 <script language=Javascript> 
  function time(){
    //       div
    t_div = document.getElementById('showtime');
   var now=new Date()
    //  div   
   t_div.innerHTML = "   "+now.getYear()
    +" "+(now.getMonth()+1)+" "+now.getDate()
    +" "+now.getHours()+" "+now.getMinutes()
    +" "+now.getSeconds()+" ";
    //        time  ,  settimeout time   ,        
   setTimeout(time,1000);
  }

</script>
  </head>
  
  <body  onload="time()">
    <div id="showtime"></div>
  </body>

</html>