-
Notifications
You must be signed in to change notification settings - Fork 2
/
zk.html
37 lines (35 loc) · 950 Bytes
/
zk.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>中考倒计时</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.countdown {
color: white;
font-size: 24px;
text-align: center;
}
</style>
</head>
<body bgcolor="black">
<div class="countdown" id="countdown"></div>
<script>
// 设置中考日期(假设为2024年6月23日)
const examDate = new Date('2024-06-23');
// 设置当前日期
const currentDate = new Date();
// 计算距离中考还有的天数
const daysLeft = Math.ceil((examDate - currentDate) / (1000 * 60 * 60 * 24));
// 在页面中显示倒计时
document.getElementById('countdown').innerText = `距离中考还有 ${daysLeft} 天`;
</script>
</body>
</html>