web calendar

Code:
  1. functionYear_Month()
  2. {
  3. varnow=newDate();
  4. varyy=now.getYear();
  5. varmm=now.getMonth()+1;/*getMonth()月份下标从0开始*/
  6. varcl='<fontcolor="#0000df">';
  7. if(now.getDay()==0)cl='<fontcolor="#c00000">';
  8. if(now.getDay()==6)cl='<fontcolor="#00c000">';
  9. return(cl+yy+'年'+mm+'月</font>');
  10. }
  11. functionDate_of_Today()
  12. {
  13. varnow=newDate();
  14. vardate=now.getDate();
  15. varcl='<fontcolor="#ff0000">';
  16. if(now.getDay()==0)cl='<fontcolor="#c00000">';
  17. if(now.getDay()==6)cl='<fontcolor="#00c000">';
  18. return(cl+date+'</font>');
  19. }
  20. functionDay_of_Today()
  21. {
  22. varday=newArray();
  23. day[0]="星期日";
  24. day[1]="周一";
  25. day[2]="周二";
  26. day[3]="周三";
  27. day[4]="周四";
  28. day[5]="周五";
  29. day[6]="周六";
  30. varnow=newDate();
  31. varcl='<fontcolor="#0000df">';
  32. if(now.getDay()==0)cl='<fontcolor="#c00000">';
  33. if(now.getDay()==6)cl='<fontcolor="#00c000">';
  34. return(cl+day[now.getDay()]+'</font>');
  35. }
  36. functionCurrentTime()
  37. {
  38. varnow=newDate();
  39. varhh=now.getHours();
  40. varmm=now.getMinutes();
  41. varss=now.getTime()%60000;
  42. ss=(ss-(ss%1000))/1000;
  43. varclock=hh+":";
  44. if(mm<10)clock+='0';
  45. clock+=mm+':';
  46. if(ss<10)clock+='0';
  47. clock+=ss;
  48. return(clock);
  49. }
  50. functionrefreshCalendarClock()
  51. {
  52. document.all.calendarClock1.innerHTML=Year_Month();
  53. document.all.calendarClock2.innerHTML=Date_of_Today();
  54. document.all.calendarClock3.innerHTML=Day_of_Today();
  55. document.all.calendarClock4.innerHTML=CurrentTime();
  56. }
  57. document.write('<tablealign="center"border="0"cellpadding="0"cellspacing="0"><tr><td>');
  58. document.write('<tableid="CalendarClockFreeCode"border="0"cellpading="0"cellspacing="0"width="160"height="170"');
  59. document.write('style="position:absolute;visibility:hiddenbgcolor="#eeeeee">')
  60. document.write('<tr><tdalign="center"');
  61. document.write('fontstyle="color:#ff0000;font-family:宋体;font-size:20pt;line-height:120%">');
  62. document.write('</td></tr></table>');
  63. document.write('<tableborder="0"cellpading="0"cellspacing="0"width="121"height="140">');
  64. document.write('<tr><tdvalign="top"width="100%"height="100%">');
  65. document.write('<tableborder="1"cellpading="0"cellspacing="0"width="116"height="134">');
  66. document.write('<tr><tdalign="center"width="100%"height="100%">');
  67. document.write('<fontid="calendarClock1"style="font-family:宋体;font-size:14pt;line-height:120%"></font><br>');
  68. document.write('<fontid="calendarClock2"style="color:#ff0000;font-family:Arial;font-size:14pt;line-height:120%"></font><br>');
  69. document.write('<fontid="calendarClock3"style="font-family:宋体;font-size:14pt;line-height:120%"></font><br>');
  70. document.write('<fontid="calendarClock4"style="color:#0000ff;font-family:宋体;font-size:16pt;line-height:120%"><b></b><br>');
  71. document.write('</td></tr></table>');
  72. document.write('</td></tr></table>');
  73. document.write('</td></tr></table>');
  74. setInterval('refreshCalendarClock()',1000);/*设置刷新时间为1秒*/

效果:

你可能感兴趣的:(calendar)