批改状态:合格
老师批语:前两天的作业呢????抓紧时间补齐
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>新年倒计时</title>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<style>
.time {
height: 400px;
width: 800px;
background-color: red;
margin: 0 auto;
}
div p
{
color:white;
line-height: 400px;
text-align: center;
}
</style>
<script>
$(function(){
var starttime = new Date("2019/2/4");
setInterval(function () {
var nowtime = new Date();
var time = starttime - nowtime;
var day = parseInt(time / 1000 / 60 / 60 / 24);
var hour = parseInt(time / 1000 / 60 / 60 % 24);
var minute = parseInt(time / 1000 / 60 % 60);
var seconds = parseInt(time / 1000 % 60);
$('P').html('距离春节倒计时还有:' + day + "天" + hour + "小时" + minute + "分钟" + seconds + "秒");
}, 1000);
})
</script>
</head>
<body>
<div>
<p></p>
</div>
</body>
</html>
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号