倒计时

/* 倒计时 */
    setInterval(function () {
        $(".time_wrap").each(function () {
            //定义变量
            var Obj = this,
                EndTime = new Date(parseInt($(Obj).attr('value'), 10) * 1000),
                NowTime = new Date(),
                nMS = EndTime.getTime() - NowTime.getTime(),
                nD = Math.floor(nMS / (1000 * 60 * 60 * 24)),
                nH = Math.floor(nMS / (1000 * 60 * 60)) % 24,
                nM = Math.floor(nMS / (1000 * 60)) % 60,
                nS = Math.floor(nMS / 1000) % 60;
            nMS = Math.floor(nMS / 100) % 10;

            if (nD >= 0) {
                var str = '<span class="timer" ><em>' + nD + '</em>天<em>' + nH + '</em>小时<em>' + nM + '</em>分<em>' + nS + '</em>秒</span>';
                $(Obj).html(str);
            }
        });
    }, 100);
高否?富否?帅否? 否? 滚去学习!
原文地址:https://www.cnblogs.com/baixc/p/3645784.html