摘要:<!DOCTYPE html> <html lang = "en"> <head> <meta charset = "UTF-8"> <ti
<!DOCTYPE html>
<html lang = "en">
<head>
<meta charset = "UTF-8">
<title>Date日期操作方法</title>
<style>
.box {
width: 100%;
height: 500px;
background: pink;
}
p {
text-align: center;
line-height: 400px;
color: #FFF;
font-size: 20px;
}
</style>
</head>
<body>
<div class = "box">
<p></p>
</div>
</body>
<script>
setInterval(function () {
var t = new Date().getTime() - new Date('2019.02.05').getTime();
if (t > 0) {
t = parseInt(t / 1000);
var seconds = parseInt(t % 60);
var mins = parseInt(t / 60 % 60);
var hours = parseInt(t / 60 / 60 % 24);
var day = parseInt(t / 60 / 60 / 24);
document.getElementsByTagName('p')[0].innerHTML = "2019年的春节已经过去了" + day + '天' + hours + '小时' + mins + '分' + seconds + '秒';
}
}, 1000);
</script>
</html>
批改老师:查无此人批改时间:2019-02-11 09:49:48
老师总结:完成的不错。这是要提前自己要努力吗?继续加油。