<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
function fn() {
var date1 = new Date()
var date2 = new Date('2021-10-1 00:00:00');
var cha = date2.getTime() - date1.getTime();
var you =parseInt(cha/1000)
var s =Math.floor (you%60);
var f = Math.floor(you / 60 % 60);
var h = Math.floor(you/ 60 / 60%24);
var t =Math.ceil(you / 60 / 60/24);
s = s < 10 ? "0" + s : s
f = f < 10 ? "0" + f : f
h = h < 10 ? "0" + h : h
return '距离国庆放假还有'+t+ "天"+ h + '小时' + f + '分钟' + s + '秒'
}
setInterval(function () {
document.body.innerHTML = fn()
}, 1000)
</script>
</body>
</html>
2021年距国庆放假倒计时
最新推荐文章于 2024-07-23 11:32:13 发布