- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>网站已安全运行</title>
- </head>
- <body>
- <div class="container">
- <h1>网站已安全运行</h1>
- <p id="time" class="time">计算中...</p>
- </div>
- <script>
- const launchDate = new Date('2024-12-13T00:00:00');//替换为实际开始时间
- function updateTime() {
- const now = new Date(), diff = Math.floor((now - launchDate) / 1000);
- const years = Math.floor(diff / (365 * 24 * 60 * 60)), days = Math.floor(diff % (365 * 24 * 60 * 60) / (24 * 60 * 60)), hours = Math.floor(diff % (24 * 60 * 60) / (60 * 60)), minutes = Math.floor(diff % (60 * 60) / 60), seconds = diff % 60;
- document.getElementById('time').innerText = `${years}年 ${days}天 ${hours}时 ${minutes}分 ${seconds}秒`;
- }
- setInterval(updateTime, 1000);
- </script>
- </body>
- </html>
复制代码 |