首页 > 技术文章 > html显示时间

qiwu1314 2016-12-08 17:21 原文

 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>

推荐阅读