版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<meta charset="utf-8" />
</head>
<body>
<script type="text/javascript">
window.onload = function () {
setInterval(function () {
var nowTime = new Date();
var hour = nowTime.getHours();
var minute = nowTime.getMinutes();
var second = nowTime.getSeconds();
hour = hour < 10 ? '0' + hour : hour;
minute = minute < 10 ? '0' + minute : minute;
second = second < 10 ? '0' + second : second;
document.body.innerText = '当前系统时间为:' + hour + ':' + minute + ':' + second;
}, 1000);
};
</script>
</body>
</html>