<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Test02.html</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="this is my page"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <!--<link rel="stylesheet" type="text/css" href="./styles.css">--> <script type="text/javascript"> function startTime(){ var today = new Date(); var h = today.getHours(); var m = today.getMinutes(); var s = today.getSeconds(); m = checkTime(m); s = checkTime(s); document.getElementById('time').innerHTML=h+":"+m+":"+s; t = setTimeout('startTime()',500); } function checkTime(i){ if(i<10){ i = "0" + i; } return i; } </script> </head> <body οnlοad="startTime()"> <!-- This is my HTML page. <br> --> <div id="time"></div> </body> </html>
使用JavaScript在网页上动态显示时钟
最新推荐文章于 2021-06-04 08:00:44 发布