jquery Countdown source Sharing

Source: Internet
Author: User

Add a container to display the countdown on the static page and refer to the script below to use it in the time parameter.

timeoutdate--expiry time format for 2014/01/01 or 2014/1/1

d--days

h--hours

m--min

s--sec

xs--Digital 0~9

Code Show:

Html:

Copy CodeThe code is as follows:
<span id= "Top_tuan_countdown" ></span>

Jquery:

Copy CodeThe code is as follows:
$ (). Ready (function () {
Ccountdown ([,, Timeoutdate], [' and <b><font color= "#ff0000" size= "4" >D</font> days </b><b> <font color= "#ff0000" size= "4" >H</font> </b><b><font color= "#ff0000" size= "4" >m</ font> </b><b><font color= "#ff0000" size= "4" >S</font> s </b><b><font color = "#ff0000" size= "4" >xs</font></b> expiry ', ' ', ' ", ' #top_tuan_countdown ', function () {$ (' #top_tuan_ Countdown '). Remove ()});
})
function Ccountdown (t, C, _self, FN) {
function nd (d) {
Return IsNaN (d)? (d. New Date (d). GetTime (): new Date (). GetTime ()): D * 1000;
}
var e = [nd (t[0]), ND (t[1]), ND (t[2]), _s = _self, b;
if (T[0] && e[0] > e[1]) {
$ (_s). HTML (c[1]);
Return
} else if (e[1] > e[2]) {
fn && fn ($ (_s));
$ (_s). HTML (c[2]);
Return
}
(b = function (l) {
var L = L | | (E[2]-e[1])/+, k = {
D:l/36000/24, h:l/36000, M:l/$, s:l/10, xs:l%
};
$ (_s). HTML (C[0].replace (/d| h| m| s|xs/g, function (m) {
var n = parseint (k[m]) + "
if (n.length = = 1 && m! = ' D ' && m! = ' xs ') {
n = 0 + N;
}
return n
}));
SetTimeout (function () {
B (L-1)
}, 100);
})()
}

jquery Countdown source Sharing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.