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

 

<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>

 

posted @ 2017-01-11 09:23  阿_猫阿_狗  阅读(236)  评论(0编辑  收藏  举报