页面显示时间----最简

<html lang="en">
<head>
<meta charset="UTF-8">
<script src="jquery-3.1.0.js"></script>
<title></title>
<style>
div{
text-align: center;
margin-top: 100px;
font-size: 30px;
}
</style>
</head>
<body>

<div>20:20:20</div>

<script>
$(function () {
var div = document.querySelector('div')
function time1 () {
var now = new Date()
div.innerHTML = now.toTimeString().substring(0, 9)
}
time1()
setInterval(time1,1000)
})
</script>
</body>
</html>
原文地址:https://www.cnblogs.com/-khj/p/6272364.html