统计阅读文章时间

站长 折腾 2022-10-9 3320

    <div id="tingliu">
        <span class="tingliu2 hint--top hint--bounce" data-hint="希望这篇文章能给你带来收获,去发表评论吧!?"> 
                <a href="##"> class="tingliu5"></a> 
        </span>&nbsp;
        <span class="tingliu2">您阅读这篇文章共花了:</span>&nbsp;<span class="tingliu3" id="stime"></span>
    </div>
    #tingliu {
        margin: 30px 0px 15px 0px;
        padding: 5px 0px 10px 0px;
        height: 100%;
        line-height: 2;
        text-align: center;
        font-size: 14px;
        background: #F1E8DF;
        border: 1px dashed #CEB8A3;
        width: 100%;
        transition: all 0.2s ease-in-out 0s;
        -moz-transition: all 0.2s ease-in-out 0s;
        -webkit-transition: all 0.2s ease-in-out 0s;
    }

    .tingliu2 {
        color: #7C4500;
    }

    .tingliu3 {
        color: #C03131;
    }

    .tingliu5 {
        position: relative;
        left: 0px;
        top: 5px;
    }
    <script language="JavaScript">
        var ss = 0,
            mm = 0,
            hh = 0;
        function TimeGo() {
            ss++;
            if (ss >= 60) {
                mm += 1;
                ss = 0
            }
            if (mm >= 60) {
                hh += 1;
                mm = 0
            }
            ss_str = (ss < 10 ? "0" + ss : ss);
            mm_str = (mm < 10 ? "0" + mm : mm);
            tMsg = "" + hh + "小时" + mm_str + "分" + ss_str + "秒";
            document.getElementById("stime").innerHTML = tMsg;
            setTimeout("TimeGo()", 1000)
        }
        TimeGo();
    </script>
──── 0人觉得很赞 ────
最新回复 (1)
  • Lv.2 lv1314521 2022-11-8
    0 引用 2
    代码学习经验。。
返回