系统维护脚本(可用于网站维护提示)
系统维护中
我们正在进行系统维护,预计恢复时间为:
在此期间,您可能无法正常访问网站。我们深表歉意,感谢您的理解和支持。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>系统维护中</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
padding: 50px;
}
h1 {
font-size: 36px;
margin-bottom: 20px;
}
p {
font-size: 24px;
margin-bottom: 20px;
}
.countdown {
font-size: 48px;
margin-bottom: 20px;
}
</style>
</head>
<body>
<h1>系统维护中</h1>
<p>我们正在进行系统维护,预计恢复时间为:</p>
<div class="countdown"></div>
<p>在此期间,您可能无法正常访问网站。我们深表歉意,感谢您的理解和支持。</p>
<script>
// 设置倒计时时间
var countDownDate = new Date("2023-03-28T02:28:00Z").getTime();
// 更新倒计时
var x = setInterval(function() {
var now = new Date().getTime();
var distance = countDownDate - now;
// 计算剩余时间
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
// 显示倒计时
document.querySelector(".countdown").innerHTML = days + " 天 " + hours + " 小时 " + minutes + " 分钟 " + seconds + " 秒 ";
// 如果倒计时结束,停止更新
if (distance < 0) {
clearInterval(x);
document.querySelector(".countdown").innerHTML = "维护已完成,请刷新访问";
}
}, 1000);
</script>
</body>
</html>
```![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/431c66ac4db142d181e17d609f255df5.jpeg#pic_center)