编辑代码

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <meta name="robots" content="noindex, nofollow"/>
    <meta name="googlebot" content="noindex, nofollow"/>
    <title>2024年安全倒计时 - JSRUN 驱动</title>

    <script type="text/javascript" src="" ></script>
    <link rel="stylesheet" type="text/css" href="main.css"/>

</head>

<!DOCTYPE html>
<html>
<head>
  <title>安全年倒计时</title>
  <style>
    .countdown {
      font-size: 100px;
      text-align: center;
      color:white;
     background-color:;
      font-family:"微软雅黑",Arial,sans-serif;
    }
      footer{    position: fixed;

    left: 0px;

    bottom: 0px;

    width: 100%;

    height: 50px;

    background-color: #000;

    z-index: 9999;

    height:60px; 

    line-height:60px;
    font-family:"微软雅黑",Arial,sans-serif;
    text-align:center;
    font-size:60px;
    color:#fff;} 
     body{height:100%;background-image: url("安全年倒计划时底图.png");}

   
  </style>
</head>
<body style="margin-top: 400px; ">

  <div class="countdown">10</div>
  
    <script>
    // 目标日期
    var targetDate = new Date("2025-01-01T00:00:00");

    // 更新倒计时
    function updateCountdown() {
      var now = new Date();
      var timeLeft = targetDate - now;

      // 计算剩余的天、小时、分钟和秒
      var days = Math.floor(timeLeft / (1000 * 60 * 60 * 24));
      var hours = Math.floor((timeLeft % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
      var minutes = Math.floor((timeLeft % (1000 * 60 * 60)) / (1000 * 60));
      var seconds = Math.floor((timeLeft % (1000 * 60)) / 1000);

      // 更新页面上的倒计时显示
      document.querySelector(".countdown").textContent = days + "天 " + hours + "小时 " + minutes + "分钟 " + seconds + "秒";

      // 每秒钟更新一次倒计时
      setTimeout(updateCountdown, 1000);
    }

    // 启动倒计时
    updateCountdown();
  </script>
</body>
</html>
<script type="application/javascript" src="main.js"></script>
</html>