吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2542|回复: 10
收起左侧

[其他转载] 考研倒计时html单文件版

[复制链接]
Domanca 发表于 2021-11-26 21:46


我寻思着这个应该勉强大概可能算是个工具。。。
虽然只是个html
编程语言区我也没看见html分区。。。(话说html不能算编程语言哈。。。)
所以就发在这个原创发布区了,如有违规,删帖就好了



下面是演示哈



可以看出来就是本地一个单html文件,有浏览器就可以运行,保存在本地,浏览器书签栏建个书签,很方便就能查看倒计时了
另外这个其实是codepen上找的一个倒计时demo改的,具体改动就是可以根据day,hour,minute,second查看倒计时
界面简单清爽,操作简单,感觉还行





至于用作其他倒计时,就需要自己改动源码,也很简单


按照上面格式更改倒计时终结时刻就行了(一定要按上面的格式!)
代码改的稀烂,纯边百度边改的,轻点批评


[HTML] 纯文本查看 复制代码
<!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>
        /* general styling */
        * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
        }

        html, body {
        height: 100%;
        margin: 0;
        }

        body {
        align-items: center;
        background-color: #ffd54f;
        display: flex;
        font-family: -apple-system, 
            BlinkMacSystemFont, 
            "Segoe UI", 
            Roboto, 
            Oxygen-Sans, 
            Ubuntu, 
            Cantarell, 
            "Helvetica Neue", 
            sans-serif;
        }

        .container {
        color: #333;
        margin: 0 auto;
        text-align: center;
        }

        h1 {
        font-weight: normal;
        letter-spacing: .125rem;
        text-transform: uppercase;
        }

        li {
        display: inline-block;
        font-size: 1.5em;
        list-style-type: none;
        padding: 1em;
        text-transform: uppercase;
        }

        li span {
        display: block;
        font-size: 4.5rem;
        }

        .emoji {
        display: none;
        padding: 1rem;
        }

        .emoji span {
        font-size: 4rem;
        padding: 0 .5rem;
        }

        [url=home.php?mod=space&uid=945662]@media[/url] all and (max-width: 768px) {
            h1 {
                font-size: 1.5rem;
            }
            
            li {
                font-size: 1.125rem;
                padding: .75rem;
            }
            
            li span {
                font-size: 3.375rem;
            }
        }

        #choices {    /*下拉框属性设置*/
            font-size: 24px;
            font-style: italic;
            font-family: 'Courier New', Courier, monospace;
            font: optional;
            background-color: #ffd54f;
        }

        #headline {   /*标题与下拉框保持一定行间距*/
            margin: 24px;
        }
    </style>
</head>
<body>
    
    <div class="container">
        <h1 id="headline">Countdown to my death:</h1>
        <select id="choices">
            <option value ="day" selected="selected">day</option>
            <option value ="hour">hour</option>
            <option value=",minute">minute</option>
            <option value="second">second</option>
          </select>
        <div id="countdown">
          <ul>
            <li><span id="days"></span>days</li>
            <li><span id="hours"></span>Hours</li>
            <li><span id="minutes"></span>Minutes</li>
            <li><span id="seconds"></span>Seconds</li>
          </ul>
        </div>
        <div id="countdown1">
            <ul>
              <li><span id="hours1"></span>Hours</li>
              <li><span id="minutes1"></span>Minutes</li>
              <li><span id="seconds1"></span>Seconds</li>
            </ul>
        </div>
        <div id="countdown2">
            <ul>
                <li><span id="minutes2"></span>Minutes</li>
                <li><span id="seconds2"></span>Seconds</li>
            </ul>
        </div>
        <div id="countdown3">
            <ul>
                <li><span id="seconds3"></span>Seconds</li>
            </ul>
        </div>
		<div>
			<br>
			<br>
			<br>
			<br>
			<br>
		</div>
        <div id="content" class="emoji">
          <span>&#129395;</span>
          <span>&#127881;</span>
          <span>&#127874;</span>
        </div>
      </div>

      <script>
          function choose(){
            var index = document.getElementById("choices").selectedIndex;
            if(index == 0){
                document.getElementById("countdown").style.display="block";
                document.getElementById("countdown1").style.display="none";
                document.getElementById("countdown2").style.display="none";
                document.getElementById("countdown3").style.display="none";
            }
            else if(index == 1){
                document.getElementById("countdown").style.display="none";
                document.getElementById("countdown1").style.display="block";
                document.getElementById("countdown2").style.display="none";
                document.getElementById("countdown3").style.display="none";
            }
            else if(index == 2){
                document.getElementById("countdown").style.display="none";
                document.getElementById("countdown1").style.display="none";
                document.getElementById("countdown2").style.display="block";
                document.getElementById("countdown3").style.display="none";
            }
            else if(index == 3){
                document.getElementById("countdown").style.display="none";
                document.getElementById("countdown1").style.display="none";
                document.getElementById("countdown2").style.display="none";
                document.getElementById("countdown3").style.display="block";
            }
          }
          (function () {
            const second = 1000,
                    minute = second * 60,
                    hour = minute * 60,
                    day = hour * 24;
            choose();
            let birthday = "Dec 25, 2021 00:00:00",
                countDown = new Date(birthday).getTime(),
            x = setInterval(function() {    
                let now = new Date().getTime(),
                    distance = countDown - now;
                document.getElementById("days").innerText = Math.floor(distance / (day)),
                document.getElementById("hours").innerText = Math.floor((distance % (day)) / (hour)),
                document.getElementById("minutes").innerText = Math.floor((distance % (hour)) / (minute)),
                document.getElementById("seconds").innerText = Math.floor((distance % (minute)) / second);

                document.getElementById("hours1").innerText = Math.floor((distance / (hour))),
                document.getElementById("minutes1").innerText = Math.floor((distance % (hour)) / (minute)),
                document.getElementById("seconds1").innerText = Math.floor((distance % (minute)) / second);
                

                document.getElementById("minutes2").innerText = Math.floor((distance / (minute)),
                document.getElementById("seconds2").innerText = Math.floor((distance % (minute)) / second));

                document.getElementById("seconds3").innerText = Math.floor((distance / second));

                //do something later when date is reached
                if (distance < 0) {
                let headline = document.getElementById("headline"),
                    countdown = document.getElementById("countdown"),
                    content = document.getElementById("content");

                headline.innerText = "It's my death!";
                countdown.style.display = "none";
                content.style.display = "block";

                clearInterval(x);
                }
                //seconds
            }, 0)
            }());
      </script>
</body>
</html>


蓝奏云
https://www.lanzouw.com/ixectwxmmze

免费评分

参与人数 4吾爱币 +3 热心值 +3 收起 理由
321651yui + 1 鼓励转贴优秀软件安全工具和文档!
TokeyJs + 1 + 1 谢谢@Thanks!
独念成慕 + 1 + 1 用心讨论,共获提升!
樂青影 + 1 加油!!!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

-林深见鹿- 发表于 2021-11-26 22:54
感谢,下载看看
Yee28 发表于 2021-11-26 23:27
年轻的心。 发表于 2021-11-27 00:42
wapj2524 发表于 2021-11-27 07:40
谢谢分享,非常实用
lcg2014 发表于 2021-11-27 08:41
学以致用,真不错
TokeyJs 发表于 2021-11-27 09:31
这个牛啊!!
大兵马元帅 发表于 2021-11-27 09:32
不考研能不能用?
wfd007 发表于 2021-11-27 09:33
这东西意义不大,复习好才是关键
Jaybo 发表于 2021-11-27 09:51
感谢分享,谢谢哥
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-25 11:46

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表