不多说废话直接上代码

<div id="jane">
    本站已艰难走过
    <span id="sitetime">
    </span>
</div>
<script type="text/javascript">
    function show_runtime() {
        window.setTimeout("show_runtime()", 1000);
        X = new Date("07/29/2020 00:00:00");
        Y = new Date();
        T = (Y.getTime() - X.getTime());
        M = 24 * 60 * 60 * 1000;
        a = T / M;
        A = Math.floor(a);
        b = (a - A) * 24;
        B = Math.floor(b);
        c = (b - B) * 60;
        C = Math.floor((b - B) * 60);
        D = Math.floor((c - C) * 60);
        sitetime.innerHTML = A + "天" + B + "小时" + C + "分" + D + "秒"
    }
    show_runtime();
</script>

本人也进行了一些美化,代码如下

#jane {
    animation:change 10s infinite;
    font-weight:800;
        text-align: center;
}
@keyframes change {
    0% {
    color:#5cb85c;
}
25% {
    color:#556bd8;
}
50% {
    color:#e40707;
}
75% {
    color:#66e616;
}
100% {
    color:#67bd31;
}
}
Last modification:August 5th, 2020 at 10:30 pm
如果觉得我的文章还不错,请支持一下