网站正计时 源码

  1. <SPANid="span_dt_dt"></SPAN>
  2. <SCRIPTlanguage=javascript>
  3. functionshow_date_time(){
  4. window.setTimeout("show_date_time()",1000);
  5. BirthDay=newDate("8/3/2014 19:10:08");//月,日,年,小时,分钟,秒
  6. today=newDate();
  7. timeold=(today.getTime()-BirthDay.getTime());
  8. sectimeold=timeold/1000
  9. secondsold=Math.floor(sectimeold);
  10. msPerDay=24*60*60*1000
  11. e_daysold=timeold/msPerDay
  12. daysold=Math.floor(e_daysold);
  13. e_hrsold=(e_daysold-daysold)*24;
  14. hrsold=setzero(Math.floor(e_hrsold));
  15. e_minsold=(e_hrsold-hrsold)*60;
  16. minsold=setzero(Math.floor((e_hrsold-hrsold)*60));
  17. seconds=setzero(Math.floor((e_minsold-minsold)*60));
  18. span_dt_dt.innerHTML="已运行"+daysold+"天"+hrsold+"小时"+minsold+"分"+seconds+"秒";
  19. }
  20. functionsetzero(i){
  21. if(i<10)
  22. {i="0"+i};
  23. returni;
  24. }
  25. show_date_time();
  26. </SCRIPT>

Last modification:January 1st, 1970 at 08:00 am
If you think my article is useful to you, please feel free to appreciate

Leave a Comment