如何在网页上添加倒计时
发布网友
发布时间:2022-04-30 08:12
我来回答
共1个回答
热心网友
时间:2022-06-19 14:48
<FONT color=#990000 size=3>网站倒计时<b><SPAN id=span_dt_dt></SPAN></b></FONT>
<SCRIPT language=javascript>
<!--
function show_date_time(){
window.setTimeout("show_date_time()", 1000);
BirthDay=new Date("17-5-2010");//
today=new Date();
timeold=(BirthDay.getTime()-today.getTime());
sectimeold=timeold/1000
secondsold=Math.floor(sectimeold);
msPerDay=24*60*60*1000
e_daysold=timeold/msPerDay
daysold=Math.floor(e_daysold);
e_hrsold=(e_daysold-daysold)*24;
hrsold=Math.floor(e_hrsold);
e_minsold=(e_hrsold-hrsold)*60;
minsold=Math.floor((e_hrsold-hrsold)*60);
seconds=Math.floor((e_minsold-minsold)*60);
span_dt_dt.innerHTML=""+daysold+"天"+hrsold+"小时"+minsold+"分"+seconds+"秒"+"" ;
}
show_date_time();
//-->
</SCRIPT>