首页 > 代码库 > html显示时间

html显示时间

 1 <html>
 2 <head>
 3 <script type="text/javascript">
 4  function time() {
 5  var time = new Date();
 6  document.getElementById("time").innerHTML = time.toLocaleTimeString();
 7  setTimeout("time()", 1000);
 8  }
 9  window.onload = time;
10  </script>
11 
12 </head>
13 <body >
14 <span id="time"></span>
15 </body>
16 </html>

技术分享

html显示时间