Copy codeThe Code is as follows:
<! 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">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> untitled document </title>
<Style>
# Lefttime3 {background: url(timerbg.jpg) no-repeat left center; width: 1018px; height: 55px;
Font-size: 40px; line-height: 55px; font-family: MS Yahei, Microsoft YaHei;
Color: # f00; color: rgb (255,205, 1 );
}
# Day {margin-left: 592px ;}
# Hour {margin-left: 40px ;}
# Min {margin-left: 39px ;}
# Sec {margin-left: 37px ;}
</Style>
<Script>
Var djs = function (d, o)
{
Var f = {
Zero: function (n ){
Var n = parseInt (n, 10 );
If (n> 0 ){
If (n <= 9) n = '0' + n;
Return String (n );
} Else {
Return '00 ';
}
},
Run: function (){
Var ts = Math. round (new Date (d). getTime ()-new Date (). getTime ()/1000 );
If (o & ts> 0)
{
Var yy = Math. floor (ts/31556926 );
Var mm = Math. floor (ts/2629744); mm = mm> 0? Mm % 12: '00 ';
Var dd = Math. floor (ts/86400); dd = dd> 0? Dd % 30: '00 ';
Var hh = Math. floor (ts/3600); hh = hh> 0? Hh % 24: '00 ';
Var ii = Math. floor (ts/60); ii = ii> 0? Ii % 60: '00 ';
Var ss = Math. floor (ts % 60 );
If (o. y) o. y. innerHTML = f. zero (yy );
If (o. m) o. m. innerHTML = f. zero (mm );
If (o. d) o. d. innerHTML = f. zero (dd );
If (o. h) o. h. innerHTML = f. zero (hh );
If (o. I) o. I. innerHTML = f. zero (ii );
If (o. s) o. s. innerHTML = f. zero (ss );
}
Window. setTimeout (f. run, 1000 );
}
}
F. run ();
}
Function ieFixed (id)
{
Var isIE = (document. all )? True: false;
Var isIE6 = isIE & ([/MSIE (\ d) \. 0/I .exe c (navigator. userAgent)] [0] [1] = 6 );
Var obj = document. getElementById (id). style;
If (isIE6 & obj)
{
Obj. position = "absolute ";
Obj. bottom = "0px ";
Obj. right = "0px ";
Var tm = window. setInterval (function (){
Obj. marginBottom = "0px ";
Obj. left = (document.doc umentElement. scrollLeft + document.doc umentElement. clientWidth-312) + "px ";
}, 80 );
}
}
</Script>
</Head>
<Body style = "height: 300000px;">
<Div id = "lll" style = "margin: 10px; padding: 20px; border: solid 2px # DDD; background: # fc6; height: 300px;"> </div>
<Div id = "lefttime3" style = "position: fixed; bottom: 0px; right: 0px; "> <span id =" day "> </span> <span id =" hour "> </span> <span id =" min "> </span> <span id = "sec"> </span> </div>
<Script>
Var d = new Date (). getTime () + 3600*24*1000;
Var d = 1379572933131;
Var o = {
D: document. getElementById ('day '),
H: document. getElementById ('hour '),
I: document. getElementById ('Min '),
S: document. getElementById ('sec ')
}
Djs (d, o); // countdown
IeFixed ('lefttime3'); // fixed at the bottom
</Script>
</Body>
</Html>
1) compatible with IE6
2) Automatic countdown. The input number must be time, in milliseconds.