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