网络隐士的Blog

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
<style type="text/css">
.tdclass 
{font-size: 9pt; padding: 4px}
</style>
<table cellspacing="0" cellpadding="0" border="0" align="center" bordercolor="white">
<tr align="center" bgcolor="#7BA5CE">
<td class="tdclass"><font color="white">公元 <span id="layerYear"></span><span id="layerMonth"></span><span id="layerDay"></span>日 星期<span id="layerWeek"></span></font></td>
</tr>
<tr align="center">
<td>
<span id="layerCalendar"></span>
</td>
</tr>
<tr align="center">
<td class="tdclass" bgcolor="#7BA5CE"><font color="white">现在时间:<span id="layerNow"></span></font></td>
</tr>
</table>
<script language="JavaScript" type="text/javascript">
<!--
// Written by caocao
//
 caocao@eastday.com
//
 http://nethermit.yeah.net
var dayArray=new Array("","","","","","","");
var monthArray=[312831303130313130313031];
var stringTable="<table cellspacing=\"0\" cellpadding=\"0\" border=\"1\" align=\"center\" bordercolor=\"#8F8FAF\"><tr bgcolor=\"#53A9FF\" align=\"center\">";
for (var i=0; i<dayArray.length; ++i)
{
 stringTable
+="<td class=\"tdclass\"><font color=\"white\"><b>"+dayArray[i]+"</b></font></td>";
}

stringTable
+="</tr>";
function setValue(tag, str)
{
 document.getElementById(tag).innerHTML
=str;
}

function showTime()
{
 
var today=new Date();
 
var currentYear=today.getFullYear()
 
if (((currentYear%4==0)&&(currentYear%100!=0))||(currentYear%400==0))
  monthArray[
1]=29;
 
var allDays=monthArray[today.getMonth()];
 
var currentWeek=today.getDay();
 
var currentDay=today.getDate();
 
var i=currentDay%7-currentWeek;
 
var threshold=(7+i)%7;
 
var isEnd=false;
 
var stringAll=stringTable;
 
while (true)
 
{
  
if (isEnd)
  
{
   stringAll
+="<td class=\"tdclass\" bgcolor=\"#EEEEEE\"> </td>";
   
if (i % 7==(threshold+6)%7)
   
{
    stringAll
+="</tr>";
    
break;
   }

  }

  
else
  
{
   
if (i % 7==threshold)
    stringAll
+="<tr align=\"center\">";
   stringAll
+=i>0?"<td class=\"tdclass\""+(i==currentDay?" bgcolor=\"#FEA477\" style=\"color: #FFFFFF\"":"")+"><b>"+i+"</b></td>":"<td class=\"tdclass\" bgcolor=\"#EEEEEE\"> </td>";
   
if (i % 7==(threshold+6)%7)
   
{
    stringAll
+="</tr>";
    
if (i==allDays)
     
break;
   }

   
if (i==allDays)
    isEnd
=true;
  }

  
++i;
 }

 stringAll
+="</table>";
 setValue(
"layerYear", currentYear);
 setValue(
"layerMonth", today.getMonth()+1);
 setValue(
"layerDay", currentDay);
 setValue(
"layerWeek", dayArray[currentWeek]);
 setValue(
"layerCalendar", stringAll);
 setValue(
"layerNow", today.getHours()+":"+today.getMinutes()+":"+today.getSeconds());
 setTimeout(
"showTime()",1000);
}

showTime()
// -->
</script>
posted on 2005-09-12 18:02  网络隐士  阅读(841)  评论(0编辑  收藏  举报