<html>
<head>
<title>
钟表效果
</title>
<meta charset="utf-8">
</head>
<script type="text/javascript">
var today;
var hour;
var fen;
var s;
var todayAction;
function todayTimeAction () {
today = new Date();
hour = today.getHours();
fen = today.getMinutes();
s = today.getSeconds();
document.getElementById("timeTxt").innerHTML = hour+":"+fen+":"+s;
todayAction = setTimeout("todayTimeAction()", 500);
}
</script>
<body οnlοad="todayTimeAction()">
<p> 北京时间</p>
</br>
<div id="timeTxt">
</div>
</body>
<html>
JAVA Script 学习之通过setTimeout 实现钟表的效果
最新推荐文章于 2022-07-27 16:26:25 发布