<!--http://www.klooks.net-->
//带农历的电子日历代码
var bsYear,bsDate,bsWeek; 
//数组长度 //当年的秒数 //当年第几天 //月份的下标 //年份标记 //年份标记 //每天的秒数 
var arrLen=8,sValue=0,dayiy=0,miy=0,iyear=0,dayim=0,spd=86400; 
var year1999="30;29;29;30;29;29;30;29;30;30;30;29"; //354 
var year2000="30;30;29;29;30;29;29;30;29;30;30;29"; //354 
var year2001="30;30;29;30;29;30;29;29;30;29;30;29;30"; //384 
var year2002="30;30;29;30;29;30;29;29;30;29;30;29"; //354 
var year2003="30;30;29;30;30;29;30;29;29;30;29;30"; //355 
var year2004="29;30;29;30;30;29;30;29;30;29;30;29;30"; //384 
var year2005="29;30;29;30;29;30;30;29;30;29;30;29"; //354 
var year2006="30;29;30;29;30;30;29;29;30;30;29;29;30"; 
var month1999="正月;二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月" 
var month2001="正月;二月;三月;四月;闰四月;五月;六月;七月;八月;九月;十月;十一月;十二月" 
var month2004="正月;二月;闰二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月" 
var month2006="正月;二月;三月;四月;五月;六月;七月;闰七月;八月;九月;十月;十一月;十二月" 
var Dn="初一;初二;初三;初四;初五;初六;初七;初八;初九;初十;十一;十二;十三;十四;十五;十六;十七;十八;十九;二十;廿一;廿二;廿三;廿四;廿五;廿六;廿七;廿八;廿九;三十"; 
var Ys=new Array(arrLen); 
Ys[0]=919094400;Ys[1]=949680000;Ys[2]=980265600; Ys[3]=1013443200;
Ys[4]=1044028800;Ys[5]=1074700800;Ys[6]=1107878400;Ys[7]=1138464000; 
var Yn=new Array(arrLen); //农历年的名称 
Yn[0]="己卯年";Yn[1]="庚辰年";Yn[2]="辛巳年";Yn[3]="壬午年";Yn[4]="癸未年";Yn[5]="甲申年";Yn[6]="乙酉年";Yn[7]="丙戌年"; 
function ShowClock(){
	var D=new Date();
	var yy=D.getYear(),mm=D.getMonth()+1,dd=D.getDate(),ww=D.getDay();
	if (ww==0) ww="<font color=RED>星 期 日</font>"; 
	if (ww==1) ww="星 期 一"; 
	if (ww==2) ww="星 期 二"; 
	if (ww==3) ww="星 期 三"; 
	if (ww==4) ww="星 期 四"; 
	if (ww==5) ww="星 期 五"; 
	if (ww==6) ww="<font color=Green>星 期 六</font>";
	var ss=parseInt(D.getTime() / 1000);
	if (yy<100) yy="19"+yy; 
	for (i=0;i<arrLen;i++) 
		if (ss>=Ys[i]){ 
			iyear=i; 
			sValue=ss-Ys[i]; //当年的秒数 
		} 
	dayiy=parseInt(sValue/spd)+1; //当年的天数 
	var dpm=year1999; 
	if (iyear==1) dpm=year2000; 
	if (iyear==2) dpm=year2001; 
	if (iyear==3) dpm=year2002; 
	if (iyear==4) dpm=year2003; 
	if (iyear==5) dpm=year2004; 
	if (iyear==6) dpm=year2005; 
	if (iyear==7) dpm=year2006; 
	dpm=dpm.split(";"); 
	var Mn=month1999; 
	if (iyear==2) Mn=month2001; 
	if (iyear==5) Mn=month2004; 
	if (iyear==7) Mn=month2006; 
	Mn=Mn.split(";"); 
	var Dn="初一;初二;初三;初四;初五;初六;初七;初八;初九;初十;十一;十二;十三;十四;十五;十六;十七;十八;十九;二十;廿一;廿二;廿三;廿四;廿五;廿六;廿七;廿八;廿九;三十"; 
	Dn=Dn.split(";"); 
	dayim=dayiy; 
	var total=new Array(13); 
	total[0]=parseInt(dpm[0]); 
	for (i=1;i<dpm.length-1;i++) total[i]=parseInt(dpm[i])+total[i-1]; 
	for (i=dpm.length-1;i>0;i--) 
		if (dayim>total[i-1]){ 
			dayim=dayim-total[i-1]; 
		miy=i; } 
	bsWeek=ww; 
	bsDate=yy+"年"+(mm<10?" ":"")+mm+"月";
	var bsDate2="<p style='font-size:27px;color:Red;font-family:Verdana;line-height:90%'><b>"+dd+"</b></p>"; 
	bsYear=Yn[iyear]; bsYear2=Mn[miy]+Dn[dayim-1]; 
	if (ss>=Ys[7]||ss<Ys[0]) bsYear=Yn[7]; 
	var clockstr='<TABLE align=center border=0 width=100% cellpadding="1" cellspacing="0" style="cursor:hand">';
	clockstr+='<TR><td height=20 align="center" width=100% nowrap style="color:navy;font-size:15px;font-family:Tahoma">'+bsDate+'</font></td></TR>';
	clockstr+='<TR><td height=20 align="center" width=100% nowrap>'+bsDate2+'</td></TR>';
	clockstr+='<TR><td height=20 align="center" width=100% nowrap>'+bsWeek+'</td></TR>';
	clockstr+='<TR><td height=20 align="center" width=100% nowrap><font color=navy>'+bsYear+bsYear2+'</font></td></TR>';
	clockstr+='</TABLE>';
	document.write(clockstr)
}
ShowClock();
<!--http://www.klooks.net-->
function tick() {
var hours, minutes, seconds, xfile;
var intHours, intMinutes, intSeconds;
var today;
today = new Date();
intHours = today.getHours();
intMinutes = today.getMinutes();
intSeconds = today.getSeconds();
if (intHours == 0) {
hours = "12:";
xfile = "<font color=#ff0000>午夜   </font>";
} else if (intHours < 12) {
hours = intHours+":";
xfile = "<font color=#ff0000>上午   </font>";
} else if (intHours == 12) {
hours = "12:";
xfile = "<font color=#ff0000>正午   </font>";
} else {
intHours = intHours - 12
hours = intHours + " : ";
xfile = "<font color=#ff0000>下午   </font>";
}
if (intMinutes < 10) {
minutes = "0"+intMinutes+" : ";
} else {
minutes = intMinutes+" : ";
}
if (intSeconds < 10) {
seconds = "0"+intSeconds+"";
} else {
seconds = intSeconds+" ";
}
timeString = xfile+hours+minutes+seconds;
Clock.innerHTML = timeString;
window.setTimeout("tick();", 100);
}
window.onload = tick;
document.writeln("<b><div id=\"Clock\" align=\"center\" style=\"font-size: 20; color:#0000ff\"><\/div><\/B>")
<!--http://www.klooks.net-->