onclock.JS
上传用户:ycdfsj258
上传日期:2022-08-04
资源大小:1094k
文件大小:1k
源码类别:

图形图象

开发平台:

Java

  1. function clockon(bgclock){
  2. var now=new Date();
  3. var year=now.getYear();
  4. var month=now.getMonth();
  5. var date=now.getDate();
  6. var day=now.getDay();
  7. var hour=now.getHours();
  8. var minu=now.getMinutes();
  9. var sec=now.getSeconds();
  10. var week;
  11. month=month+1;
  12. if(month<10) month="0"+month;
  13. if(date<10) date="0"+date;
  14. if(hour<10) hour="0"+hour;
  15. if(minu<10) minu="0"+minu;
  16. if(sec<10) sec="0"+sec;
  17. var arr_week=new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
  18. week=arr_week[day];
  19. var time="";
  20. time=year+"年"+month+"月"+date+"日 "+week+" "+hour+":"+minu+":"+sec;
  21. if(document.all){
  22. bgclock.innerHTML="["+time+"]"
  23. }
  24. var timer=setTimeout("clockon(bgclock)",200);