现在的位置: 首页 > 综合 > 正文

小巧实用的日历

2018年04月09日 ⁄ 综合 ⁄ 共 3029字 ⁄ 字号 评论关闭
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
  2. <html xmlns="http://www.w3.org/1999/xhtml"> 
  3. <head> 
  4. <title>小巧实用的日历</title> 
  5. <meta http-equiv="content-type" content="text/html;charset=gb2312"> 
  6. </head> 
  7. <body> 
  8. <!--把下面代码加到<body>与</body>之间--> 
  9. <div style="position:relative;top:0px;left:0px;width:80px;height:120px;overflow:hidden"> 
  10. <script language="javascript"> 
  11. function Year_Month(){   
  12.     var now = new Date(); 
  13.     var yy = now.getFullYear();  
  14.     var mm = now.getMonth()+1; 
  15.     var cl = '<font color="#000000">'
  16.     if (now.getDay() == 0) cl = '<font color="#000000">'
  17.     if (now.getDay() == 6) cl = '<font color="#000000">'
  18.     return(cl +  yy + '年' + mm + '月</font>'); 
  19. function Date_of_Today(){   
  20.     var now = new Date(); 
  21.     var cl = '<font color="#000000">'
  22.     if (now.getDay() == 0) cl = '<font color="#000000">'
  23.     if (now.getDay() == 6) cl = '<font color="#000000">'
  24.     return(cl +  now.getDate() + '<b></b></font>'); 
  25. function Day_of_Today(){   
  26.     var day = new Array(); 
  27.     day[0] = "星期日"; 
  28.     day[1] = "星期一"; 
  29.     day[2] = "星期二"; 
  30.     day[3] = "星期三"; 
  31.     day[4] = "星期四"; 
  32.     day[5] = "星期五"; 
  33.     day[6] = "星期六"; 
  34.     var now = new Date(); 
  35.     var cl = '<font color="#000000">'
  36.     if (now.getDay() == 0) cl = '<font color="#000000">'
  37.     if (now.getDay() == 6) cl = '<font color="#000000">'
  38.     return(cl +  day[now.getDay()] + '</font>'); 
  39. }  
  40. function CurentTime(){   
  41.     var now = new Date(); 
  42.     var hh = now.getHours(); 
  43.     var mm = now.getMinutes(); 
  44.     var ss = now.getTime() % 60000; 
  45.     ss = (ss - (ss % 1000)) / 1000; 
  46.     var clock = hh+':'; 
  47.     if (mm < 10) clock += '0'; 
  48.     clock += mm+':'; 
  49.     if (ss < 10) clock += '0'; 
  50.     clock += ss; 
  51.     return(clock); 
  52. function refreshCalendarClock(){ 
  53.     document.all.calendarClock1.innerHTML = Year_Month(); 
  54.     document.all.calendarClock2.innerHTML = Date_of_Today(); 
  55.     document.all.calendarClock3.innerHTML = Day_of_Today(); 
  56.     document.all.calendarClock4.innerHTML = CurentTime(); 
  57. document.write('<table border="0" cellpadding="0" cellspacing="1" width="68" bgcolor="#000000" height="60">');  
  58. document.write('<tr><td width="100%" height="100%" align="center">'); 
  59. document.write('<table border="0" cellpadding="0" cellspacing="0" width="100%" hight="100%" bgcolor="#f2f2f2" height="60">');  
  60. document.write('<tr><td align="center" width="100%" height="100%">'); 
  61. document.write('<font id="calendarClock1" style="font-family:宋体;font-size:9pt"></font><br>');  
  62. document.write('<font id="calendarClock2" style="font-family:Arial;font-size:14pt;Line-Height=100%"></font><br>');  
  63. document.write('<font id="calendarClock3" style="font-family:宋体;font-size:9pt;Line-Height=100%"></font><br>');  
  64. document.write('<font id="calendarClock4" style="color:#000000;font-family:Arial;font-size:8pt;Line-Height=100%"><b></b></font>');  
  65. document.write('</td></tr></table>');  
  66. document.write('</td></tr></table>');  
  67. setInterval('refreshCalendarClock()',1000); 
  68. </script> 
  69. </div> 
  70. </body> 
  71. </html> 

 

抱歉!评论已关闭.