倒计时代码
Code
1<SCRIPT language=javascript>
2<!--
3//document.write("");
4
5function show_date_time_2008(){
6window.setTimeout("show_date_time_2008()", 1000);
7BirthDay=new Date("2008/9/14"); //这个日期是可以修改的
8today=new Date();
9timeold=(BirthDay.getTime()-today.getTime());
10sectimeold=timeold/1000
11secondsold=Math.floor(sectimeold);
12msPerDay=24*60*60*1000
13e_daysold=timeold/msPerDay
14daysold=Math.floor(e_daysold);
15e_hrsold=(e_daysold-daysold)*24;
16hrsold=Math.floor(e_hrsold);
17e_minsold=(e_hrsold-hrsold)*60;
18minsold=Math.floor((e_hrsold-hrsold)*60);
19seconds=Math.floor((e_minsold-minsold)*60);
20if(daysold<0)
21{
22 span_dt_dt_2008.innerHTML="<align=center><font color=696969>"+(-daysold)+"天前"+hrsold+"小时"+minsold+"分"+seconds+"秒"+"<br></font>" ;
23}
24else
25{
26 span_dt_dt_2008.innerHTML="<align=center><font color=696969>"+daysold+"天"+hrsold+"小时"+minsold+"分"+seconds+"秒"+"<br></font>" ;
27}
28
29}
30
31show_date_time_2008();
32
33//-->
34</SCRIPT>
35
36<span id="span_dt_dt_2008"></span>
1<SCRIPT language=javascript>
2<!--
3//document.write("");
4
5function show_date_time_2008(){
6window.setTimeout("show_date_time_2008()", 1000);
7BirthDay=new Date("2008/9/14"); //这个日期是可以修改的
8today=new Date();
9timeold=(BirthDay.getTime()-today.getTime());
10sectimeold=timeold/1000
11secondsold=Math.floor(sectimeold);
12msPerDay=24*60*60*1000
13e_daysold=timeold/msPerDay
14daysold=Math.floor(e_daysold);
15e_hrsold=(e_daysold-daysold)*24;
16hrsold=Math.floor(e_hrsold);
17e_minsold=(e_hrsold-hrsold)*60;
18minsold=Math.floor((e_hrsold-hrsold)*60);
19seconds=Math.floor((e_minsold-minsold)*60);
20if(daysold<0)
21{
22 span_dt_dt_2008.innerHTML="<align=center><font color=696969>"+(-daysold)+"天前"+hrsold+"小时"+minsold+"分"+seconds+"秒"+"<br></font>" ;
23}
24else
25{
26 span_dt_dt_2008.innerHTML="<align=center><font color=696969>"+daysold+"天"+hrsold+"小时"+minsold+"分"+seconds+"秒"+"<br></font>" ;
27}
28
29}
30
31show_date_time_2008();
32
33//-->
34</SCRIPT>
35
36<span id="span_dt_dt_2008"></span>