京东倒计时

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>Document</title>
    <script src="jq.js"></script>
    <script>
    function e(e) {
        if (void 0 != e && null != e) {
            var t = n.exec($.trim("" + e));
            if (t[2]) {
                var a = parseFloat(t[1]),
                    i = s[t[2]] || 1;
                return a * i
            }
            return e
        }
    };
    var t = 1,
        a = [],
        i = "$.timer",
        n = /^([0-9]+(?:\.[0-9]*)?)\s*(.*s)?$/,
        s = {
            ms: 1,
            cs: 10,
            ds: 100,
            s: 1e3,
            das: 1e4,
            hs: 1e5,
            ks: 1e6
        };
    $.extend({
        timer: {
            add: function(n, s, o, r, l) {
                var c = 0;
                if ($.isFunction(o) && (l || (l = r), r = o, o = s), s = e(s), !("number" != typeof s || isNaN(s) || 0 > s)) {
                    ("number" != typeof l || isNaN(l) || 0 > l) && (l = 0);
                    var d = $.data(n, i) || $.data(n, i, {});
                    d[o] || (d[o] = {}), r.timerID = r.timerID || t++;
                    var u = function() {
                        (++c > l && 0 !== l || r.call(n, c) === !1) && $.timer.remove(n, o, r)
                    };
                    u.timerID = r.timerID, d[o][r.timerID] || (d[o][r.timerID] = setInterval(u, s)), a.push(n)
                }
            },
            remove: function(e, t, a) {
                var n, s = $.data(e, i);
                if (s) {
                    if (t) {
                        if (s[t]) {
                            if (a) a.timerID && (clearInterval(s[t][a.timerID]), delete s[t][a.timerID]);
                            else
                                for (var a in s[t]) clearInterval(s[t][a]), delete s[t][a];
                            for (n in s[t]) break;
                            n || (n = null, delete s[t])
                        }
                    } else
                        for (t in s) this.remove(e, t, a);
                    for (n in s) break;
                    n || $.removeData(e, i)
                }
            }
        }
    });
    $.fn.extend({
        everyTime: function(e, t, a, i) {
            return this.each(function() {
                $.timer.add(this, e, t, a, i)
            })
        },
        oneTime: function(e, t, a) {
            return this.each(function() {
                $.timer.add(this, e, t, a, 1)
            })
        },
        stopTime: function(e, t) {
            return this.each(function() {
                $.timer.remove(this, e, t)
            })
        }
    })


function multiclock_channel_brand_teams(e) {
    var t = parseInt($("#" + e).attr("diff"));
    if (!(!t > 0)) {
        var a = (new Date).getTime(),
            i = function() {
                var i = (new Date).getTime(),
                    n = t + a - i;
                if (n > 0) {
                    var s = parseInt(n / 864e5);
                    n %= 864e5;
                    var o = parseInt(n / 36e5);
                    n %= 36e5;
                    var r, l = parseInt(n / 6e4),
                        n = parseInt(Math.round(n % 6e4) / 1e3);
                    r = s >= 3 ? "剩余时间3天以上" : 0 == s ? o > 0 ? "剩余时间" + o + "小时" + l + "分钟" + n + "秒" : l > 0 ? "剩余时间" + l + "分钟" + n + "秒" : "剩余时间" + n + "秒" : "剩余时间" + s + "天" + o + "小时" + l + "分钟" + n + "秒", $("#" + e).html(r)
                }
            };
        $("#" + e).everyTime(996, e, i)
    }
}
    </script>
</head>
<body>
    <div class="time" id="deal-timeleft124032758117a3e2-7c47-4c30-b000-561834182635" curtime="1405754547000" diff="151653000">剩余时间1天17小时22分钟28秒</div>

    <script type="text/javascript">
        jQuery.each($(".time"),function(){
            multiclock_channel_brand_teams($(this).attr("id"));
        });
    </script>

</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值