<!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>
显示当前系统时间(new date()..getHours())
最新推荐文章于 2023-09-07 17:12:43 发布