<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script>
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('d1').innerHTML=h+":"+m+":"+s;
setTimeout('startTime()',1000);
}
function checkTime(i){
if(i<10){
i='0'+i;
}
return i;
}
</script>
</head>
<body οnlοad="startTime()">
<div id="d1">
</div>
</body>
</html>
js写的简单动态显示系统时间
最新推荐文章于 2022-11-17 20:03:13 发布