过期域名预定抢注

 找回密碼
 免费注册

貼個奧運倒計時的代碼!

[複製鏈接]
發表於 2007-8-10 12:08:44 | 顯示全部樓層 |閱讀模式
奧運倒計時<span id="timeDate">載入天數...</span><span id="times">載入倒計時秒...</span>6 s6 y( Z# k+ @
<script>1 K& n7 n$ Y7 i1 O
var now = new Date();
6 H# d* ]6 s; ]/ y8 \4 N. d3 l0 sfunction createtime(){
0 E. q8 u( M, J- G' o. n6 h7 O" v9 M, w) s3 h4 w- I% P
var grt= new Date("8/08/2008 20:00:00");
" d4 U! K! o0 C' M: I9 `$ T+ B) p
& I# Q( ^6 a5 h% P2 y8 y/ j4 Xnow.setTime(now.getTime()+250);7 a4 [* o! f2 T# b; @8 n6 n
days = (grt - now) / 1000 / 60 / 60 / 24;
0 o$ [8 X$ F& Q  f& r& X. r7 f: ^dnum = Math.floor(days);
% R1 q1 l% W! s" o1 [. Lhours = (grt - now) / 1000 / 60 / 60 - (24 * dnum);
! |* ~  }% X, G& h3 P7 z. ~hnum = Math.floor(hours);4 u4 u! {+ J: m  ~8 H0 t
if(String(hnum).length ==1 ){hnum = "0" + hnum;}
1 f' p2 X' U) V" P+ S6 y+ a# p: bminutes = (grt - now) / 1000 /60 - (24 * 60 * dnum) - (60 * hnum);. @' [2 N9 k' l$ u1 H
mnum = Math.floor(minutes);( M; w$ d( n) D& Y0 F( f4 v9 r1 T
if(String(mnum).length ==1 ){mnum = "0" + mnum;}" ^0 _! m. W4 A6 f9 O8 f% L* i
seconds = (grt - now) / 1000 - (24 * 60 * 60 * dnum) - (60 * 60 * hnum) - (60 * mnum);
  Z( o4 a9 m0 e1 j6 Y. isnum = Math.round(seconds);
- L( o  E0 b* O& l  E7 fif(String(snum).length ==1 ){snum = "0" + snum;}
) c9 K9 N$ e' ^* |; H/ B( @0 K+ {% v0 f6 d
document.getElementById("timeDate").innerHTML = dnum+"天";  X# b1 O/ Q6 N, c  g8 W/ |3 o
document.getElementById("times").innerHTML = hnum + ":" + mnum + ":" + snum;
* k: W9 J/ S/ v}
: k' C( u8 H5 ]' z3 t! U* E/ `* a% P6 V4 D7 R& P$ F
setInterval("createtime()",250);                5 m# I" T2 n1 r5 @, t& k
</script>
. a& A: |6 e8 }  Y
( E. s6 \9 H! O  P& {6 Q0 J
& h6 Q0 |' Y$ y" [- n' L- ]  @
9 p% W! V, H' ^% f( ^- x演示:http://www.zzwang.com/
您需要登錄後才可以回帖 登錄 | 免费注册

本版積分規則

4um點基跨境網編創業社區

GMT+8, 2024-11-27 21:24

By DZ X3.5

小黑屋

快速回復 返回頂部 返回列表