秒杀倒计时

24 篇文章 0 订阅
10 篇文章 0 订阅

在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0px;
        padding: 0px;
      }

      .box {
        box-sizing: border-box;
        margin: 100px auto;
        width: 500px;
        min-height: 700px;
        background-color: rgb(216, 0, 0);
      }

      .top {
        box-sizing: border-box;
        width: 500px;
        height: 350px;
        padding: 5px;
        padding-top: 35px;
        text-align: center;
        line-height: 130px;
        font-size: 70px;
        color: rgb(255, 255, 255);
        font-weight: bold;
      }
      .bottom {
        padding: 10px;
      }
      .lefts {
        box-sizing: border-box;
        text-align: center;
        margin: 0 10px;
        height: 140px;
        background-color: rgb(0, 0, 0);
        color: azure;
        padding: 19px;
        font-size: 80px;
        font-weight: bold;
      }
      .left {
        box-sizing: border-box;
        margin: 10px;
        float: left;
        width: 140px;
        height: 140px;
        background-color: rgb(0, 0, 0);
        color: azure;
        padding: 19px;
        font-size: 80px;
        font-weight: bold;
      }

      .center {
        box-sizing: border-box;
        margin: 10px;
        float: left;
        width: 140px;
        height: 140px;
        background-color: rgb(0, 0, 0);
        color: azure;
        padding: 19px;
        font-size: 80px;
        font-weight: bold;
      }

      .right {
        box-sizing: border-box;
        margin: 10px;
        float: left;
        width: 140px;
        height: 140px;
        background-color: rgb(0, 0, 0);
        color: azure;
        padding: 19px;
        font-size: 80px;
        font-weight: bold;
      }
    </style>
  </head>
  <body>
    <script>
      document.addEventListener("DOMContentLoaded", function() {
        var Y = document.querySelector(".lefts");
        var hour = document.querySelector(".left");
        var minute = document.querySelector(".center");
        var second = document.querySelector(".right");
        timer();
        var clock = window.setInterval(function() {
          timer();
        }, 1000);
        function timer() {
          var nowtime = new Date();
          var aimtime = new Date("2025-1-15 00:00:00");
          console.log((aimtime - nowtime) / 1000 / 60 / 60 / 24);
          time = (aimtime - nowtime) / 1000;
          Y.innerHTML = parseInt(time / 60 / 60 / 24) + " 天";
          var h = parseInt((time / 60 / 60) % 24);
          h = h < 10 ? "0" + h : h;
          hour.innerHTML = h;
          var m = parseInt((time / 60) % 60);
          m = m < 10 ? "0" + m : m;
          minute.innerHTML = m;
          var s = parseInt(time % 60);
          s = s < 10 ? "0" + s : s;
          second.innerHTML = s;
        }
      });
    </script>
    <div class="box">
      <div class="top">11.11<br />秒杀倒计时</div>

      <div class="bottom">
        <div class="lefts"></div>
        <div class="left"></div>
        <div class="center"></div>
        <div class="right"></div>
      </div>
    </div>
  </body>
</html>

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

周亚鑫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值