如下:
document.write('')
function countdown(){
var today=new Date()
var todayy=today.getYear()
if (todayy todayy =1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todayh=today.getHours()
var todaymin=today.getMinutes()
var todaysec=today.getSeconds ()
var todaystring=montharray[todaym] " " todayd ", " todayy " " todayh ":" todaymin ":" todaysec
futurestring=montharray[mo-1] " " da ", " yr
futurestring=montharray[mo-1] " " da ", " yr
dd=Date.parse(futurestring)-Date.parse(todaystring)
dday=Math.floor(dd/(60*60*1000*24)*1)
dhour=Math.floor((dd %(60*60*1000*24))/(60*60*1000)*1)
dmin=Math.floor(((dd%(60*60*1000*24))%(60*60 *1000))/(60*1000)*1)
dsec=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))%(60* 1000))/1000*1)
if(ddayif (document.layers){
document. countdownnssub.document.write(opentags message_on_occasion closetags)
document.countdownnsmain.document.countdownnssub.document.close()
}
}
else if (ddayif (document.layers){
(opentags "時間已經過了!" closetags)
document.countdownnsmain.document.countdownnssub.document.close()
}
else if (document.all||document.getElementBy}
else if (document.all||document.getElementBy)
crosscount .innerHTML=opentags "Occasion already passed! " closetags
return
}
else{
if (document.layers){
document.countns.document. dday " days, " dhour " hours, " dmin " minutes, and " dsec " seconds left until " occasion closetags)
document.countdownnsmain.document.countdownnssub.document.close()
}crosscount.innerHTML=opentags "還有" dday " 天, " dhour " 小時, " dmin " 分, " dsec " 秒就是" occasion closetags
}
setTimeout("countdown()",1000)
}