日历和时间显示代码

最简单实用的
<div id="a"><script>setInterval("a.innerHTML=new Date().toLocaleString()+'星期'+'日一二三四五六'.charAt(new Date().getDay())",500)</script></div>

再来个,稍麻烦点,效果也不错。
<script language="JavaScript" type="text/javascript">
today=new Date();
function initArray(){
this.length=initArray.arguments.length
for(var i=0;i<this.length;i++)
this[i+1]=initArray.arguments[i] }
var d=new initArray(
" 星期日",
" 星期一",
" 星期二",
" 星期三",
" 星期四",
" 星期五",
" 星期六");
document.write(
"今天是: ",
today.getYear(),"年",
today.getMonth()+1,"月",
today.getDate(),"日",
d[today.getDay()+1],
"" );
</script>
正常时间显示
<SCRIPT language=javascript>
<!--
function Year_Month(){
 var now = new Date();
 var yy = now.getYear();
 var mm = now.getMonth();
 var mmm=new Array();
 mmm[0]="January";
 mmm[1]="February ";
 mmm[2]="March";
 mmm[3]="April";
 mmm[4]="May";
 mmm[5]="June";
 mmm[6]="July";
 mmm[7]="August";
 mmm[8]="September";
 mmm[9]="October";
 mmm[10]="November";
 mmm[11]="December";
 mm=mmm[mm];
 return(mm ); }
function thisYear(){
 var now = new Date();
 var yy = now.getYear();
 return(yy ); }
 function Date_of_Today(){
 var now = new Date();
 return(now.getDate() ); }
 function CurentTime(){
 var now = new Date();
 var hh = now.getHours();
 var mm = now.getMinutes();
 var ss = now.getTime() % 60000;
 ss = (ss - (ss % 1000)) / 1000;
 var clock = hh+':';
 if (mm < 10) clock += '0';
 clock += mm+':';
 if (ss < 10) clock += '0';
 clock += ss;
 return(clock); }
function refreshCalendarClock(){
document.all.calendarClock1.innerHTML = Year_Month();
document.all.calendarClock2.innerHTML = Date_of_Today();
document.all.calendarClock3.innerHTML =thisYear();
document.all.calendarClock4.innerHTML = CurentTime(); }
document.write('<font id="calendarClock1" > </font>&nbsp;');
document.write('<font id="calendarClock2" > </font>,');
document.write('<font id="calendarClock3" > </font>&nbsp;');
document.write('<font id="calendarClock4" > </font>');
setInterval('refreshCalendarClock()',1000);
//-->
</SCRIPT>
<script language="javascript" src="./script/date.js"></script>

背景时钟
<head>
<script language=javaScript>
<!--//
function clockon() {
thistime= new Date()
var hours=thistime.getHours()
var minutes=thistime.getMinutes()
var seconds=thistime.getSeconds()
if (eval(hours) <10) {hours="0"+hours}
if (eval(minutes) < 10) {minutes="0"+minutes}
if (seconds < 10) {seconds="0"+seconds}
thistime = hours+":"+minutes+":"+seconds
if(document.all) {
bgclocknoshade.innerHTML=thistime
bgclockshade.innerHTML=thistime
}
if(document.layers) {
document.bgclockshade.document.write('<div id="bgclockshade" style="position:absolute;visibility:visible;font-family:Verdana;color:FFAAAAA;font-size:120px;top:10px;left:152px">'+thistime+'</div>')
document.bgclocknoshade.document.write('<div id="bgclocknoshade" style="position:absolute;visibility:visible;font-family:Verdana;color:DDDDDD;font-size:120px;top:10px;left:150px">'+thistime+'</div>')
document.close()
}
var timer=setTimeout("clockon()",200)
}

//-->

</script>
</head>
<body bgcolor="#ffffff" onLoad="clockon()">
<div id="bgclockshade" style="position:absolute;visibility:visible;font-family:Arial;color:333333;font-size:120px;top:102px;left:152px"></div>
<div id="bgclocknoshade" style="position:absolute;visibility:visible;font-family:Arial;color:0099ff;font-size:120px;top:100px;left:150px"></div>
<div id="mainbody" style="position:absolute; visibility:visible">
</div>
</body>

石英钟
<SCRIPT language=javascript>
pX=200;pY=100
obs = new Array(13)
function ob () {
for (i=0; i<13; i++) {
 if (document.all) obs[i]=new Array (eval('ob'+i).style,-100,-100)
 else obs[i] = new Array (eval('document.ob'+i),-100,-100)
 }
}
function cl(a,b,c){
 if (document.all) {
 if (a!=0) b+=-1
 eval('c'+a+'.style.pixelTop='+(pY+(c)))
 eval('c'+a+'.style.pixelLeft='+(pX+(b)))
 }
else{
 if (a!=0) b+=10
 eval('document.c'+a+'.top='+(pY+(c)))
 eval('document.c'+a+'.left='+(pX+(b)))
}
if (document.all) c0.style.pixelLeft=26
}

function runClock() {
 for (i=0; i<13; i++) {
 obs[i][0].left=obs[i][1]+pX
 obs[i][0].top=obs[i][2]+pY
 }
}

var lastsec
function timer() {
 time = new Date ()
 sec = time.getSeconds()
 if (sec!=lastsec) {

 lastsec = sec
 sec=Math.PI*sec/30
 min=Math.PI*time.getMinutes()/30
 hr =Math.PI*((time.getHours()*60)+time.getMinutes())/360
 for (i=1;i<6;i++) {
 obs[i][1] = Math.sin(sec) * (44 - (i-1)*11)-16;
 if (document.layers)obs[i][1]+=10;
 obs[i][2] = -Math.cos(sec) * (44 - (i-1)*11)-27;
 }
 for (i=6;i<10;i++) {
 obs[i][1] = Math.sin(min) * (40 - (i-6)*10)-16;
 if (document.layers)obs[i][1]+=10;
 obs[i][2] = -Math.cos(min) * (40 - (i-6)*10)-27;
 }
 for (i=10;i<13;i++) {
 obs[i][1] = Math.sin(hr) * (37 - (i-10)*11)-16;
 if (document.layers)obs[i][1]+=10;
 obs[i][2] = -Math.cos(hr) * (37 - (i-10)*11)-27;
 }
 }

}
function setNum(){

cl (0,-67,-65);
cl (1,10,-51);
cl (2,28,-33);
cl (3,35,-8);
cl (4,28,17);
cl (5,10,35);
cl (6,-15,42);
cl (7,-40,35);
cl (8,-58,17);
cl (9,-65,-8);
cl (10,-58,-33);
cl (11,-40,-51);
cl (12,-16,-56);
}
//-->
</SCRIPT>
</head>
<body onLoad="ob(),setNum(),setInterval('timer()',100);setInterval('runClock()',100)">
<div align="center" id="c0" style="position:absolute;right:6;top:33px; z-index:2;; left: 24px">
</div>
 <div id="c1" style="position:absolute;left:20;top:-20; z-index:5;font-size:11px;"><b>1</b></div>
 <div id="c2" style="position:absolute;left:20;top:-20; z-index:5;font-size:11px;"><b>2</b></div>
 <div id="c3" style="position:absolute;left:20;top:-20; z-index:5;font-size:11px;"><b>3</b></div>
 <div id="c4" style="position:absolute;left:20;top:-20; z-index:5;font-size:11px;"><b>4</b></div>
 <div id="c5" style="position:absolute;left:20;top:-20; z-index:5;font-size:11px;"><b>5</b></div>
 <div id="c6" style="position:absolute;left:20;top:-20; z-index:5;font-size:11px;"><b>6</b></div>
 <div id="c7" style="position:absolute;left:20;top:-20; z-index:5;font-size:11px;"><b>7</b></div>
 <div id="c8" style="position:absolute;left:20;top:-20; z-index:5;font-size:11px;"><b>8</b></div>
 <div id="c9" style="position:absolute;left:20;top:-20; z-index:5;font-size:11px;"><b>9</b></div>
 <div id="c10" style="position:absolute;left:20;top:-20; z-index:5;font-size:11px;"><b>10</b></div>
 <div id="c11" style="position:absolute;left:20;top:-20; z-index:5;font-size:11px;"><b>11</b></div>
 <div id="c12" style="position:absolute;left:20;top:-20; z-index:5;font-size:11px;"><b>12</b></div>
 <div id="ob0" style="position:absolute;left:-20;top:-20;z-index:1"> </div>
 <div id="ob1" style="position:absolute;left:-20;top:-20;z-index:8"> <font size="+3" color="#0000FF"><b>.</b></font></div>
 <div id="ob2" style="position:absolute;left:-20;top:-20;z-index:8"> <font size="+3" color="#0000FF"><b>.</b></font></div>
 <div id="ob3" style="position:absolute;left:-20;top:-20;z-index:8"> <font size="+3" color="#0000FF"><b>.</b></font></div>
 <div id="ob4" style="position:absolute;left:-20;top:-20;z-index:8"> <font size="+3" color="#0000FF"><b>.</b></font></div>
 
<div id="ob5" style="position:absolute;left:-19px;top:31px;z-index:8"> <font size="+3" color="#0000FF"><b>.</b></font></div>
 <div id="ob6" style="position:absolute;left:-20;top:-20;z-index:7"> <font size="+3" color="#00FFFF"><b>.</b></font></div>
 <div id="ob7" style="position:absolute;left:-20;top:-20;z-index:7"> <font size="+3" color="#00FFFF"><b>.</b></font></div>
 <div id="ob8" style="position:absolute;left:-20;top:-20;z-index:7"> <font size="+3" color="#00FFFF"><b>.</b></font></div>
 <div id="ob9" style="position:absolute;left:-20;top:-20;z-index:7"> <font size="+3" color="#00FFFF"><b>.</b></font></div>
 <div id="ob10" style="position:absolute;left:-20;top:-20;z-index:6"> <font size="+3" color="#F30000"><b>.</b></font></div>
 <div id="ob11" style="position:absolute;left:-20;top:-20;z-index:6"> <font size="+3" color="#F30000"><b>.</b></font></div>
 <div id="ob12" style="position:absolute;left:-20;top:-20;z-index:6"> <font size="+3" color="#F30000"><b>.</b></font></div>
</body>

跟随鼠标的钟
<SCRIPT language=JavaScript>
dCol='cc0000';//date colour.
fCol='0099ff';//face colour.
sCol='ff0000';//seconds colour.
mCol='0099ff';//minutes colour.
hCol='0099ff';//hours colour.
ClockHeight=40;
ClockWidth=40;
ClockFromMouseY=0;
ClockFromMouseX=100;
//Alter nothing below! Alignments will be lost!
d=new Array("SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY");
m=new Array("JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER");
date=new Date();
day=date.getDate();
year=date.getYear();
if (year < 2000) year=year+1900;
TodaysDate=" "+d[date.getDay()]+" "+day+" "+m[date.getMonth()]+" "+year;
D=TodaysDate.split('');
H='...';
H=H.split('');
M='....';
M=M.split('');
S='.....';
S=S.split('');
Face='1 2 3 4 5 6 7 8 9 10 11 12';
font='tahoma';
size=1;
speed=0.6;
ns=(document.layers);
ie=(document.all);
Face=Face.split(' ');
n=Face.length;
a=size*10;
ymouse=0;
xmouse=0;
scrll=0;
props="<font face="+font+" size="+size+" color="+fCol+">";
props2="<font face="+font+" size="+size+" color="+dCol+">";
Split=360/n;
Dsplit=360/D.length;
HandHeight=ClockHeight/4.5
HandWidth=ClockWidth/4.5
HandY=-7;
HandX=-2.5;
scrll=0;
step=0.06;
currStep=0;
y=new Array();x=new Array();Y=new Array();X=new Array();
for (i=0; i < n; i++){y[i]=0;x[i]=0;Y[i]=0;X[i]=0}
Dy=new Array();Dx=new Array();DY=new Array();DX=new Array();
for (i=0; i < D.length; i++){Dy[i]=0;Dx[i]=0;DY[i]=0;DX[i]=0}
if (ns){
for (i=0; i < D.length; i++)
document.write('<layer name="nsDate'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+props2+D[i]+'</font></center></layer>');
for (i=0; i < n; i++)
document.write('<layer name="nsFace'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+props+Face[i]+'</font></center></layer>');
for (i=0; i < S.length; i++)
document.write('<layer name=nsSeconds'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+sCol+'><center>'+S[i]+'</center></font></layer>');
for (i=0; i < M.length; i++)
document.write('<layer name=nsMinutes'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+mCol+'><center>'+M[i]+'</center></font></layer>');
for (i=0; i < H.length; i++)
document.write('<layer name=nsHours'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+hCol+'><center>'+H[i]+'</center></font></layer>');
}
if (ie){
document.write('<div id="Od" style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=0; i < D.length; i++)
document.write('<div id="ieDate" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+props2+D[i]+'</font></div>');
document.write('</div></div>');
document.write('<div id="Of" style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=0; i < n; i++)
document.write('<div id="ieFace" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+props+Face[i]+'</font></div>');
document.write('</div></div>');
document.write('<div id="Oh" style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=0; i < H.length; i++)
document.write('<div id="ieHours" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+hCol+';text-align:center">'+H[i]+'</div>');
document.write('</div></div>');
document.write('<div id="Om" style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=0; i < M.length; i++)
document.write('<div id="ieMinutes" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+mCol+';text-align:center">'+M[i]+'</div>');
document.write('</div></div>')
document.write('<div id="Os" style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=0; i < S.length; i++)
document.write('<div id="ieSeconds" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+sCol+';text-align:center">'+S[i]+'</div>');
document.write('</div></div>')
}
(ns)?window.captureEvents(Event.MOUSEMOVE):0;
function Mouse(evnt){
ymouse = (ns)?evnt.pageY+ClockFromMouseY-(window.pageYOffset):event.y+ClockFromMouseY;
xmouse = (ns)?evnt.pageX+ClockFromMouseX:event.x+ClockFromMouseX;
}
(ns)?window.onMouseMove=Mouse:document.onmousemove=Mouse;
function ClockAndAssign(){
time = new Date ();
secs = time.getSeconds();
sec = -1.57 + Math.PI * secs/30;
mins = time.getMinutes();
min = -1.57 + Math.PI * mins/30;
hr = time.getHours();
hrs = -1.575 + Math.PI * hr/6+Math.PI*parseInt(time.getMinutes())/360; if (ie){
Od.style.top=window.document.body.scrollTop;
Of.style.top=window.document.body.scrollTop;
Oh.style.top=window.document.body.scrollTop;
Om.style.top=window.document.body.scrollTop;
Os.style.top=window.document.body.scrollTop;
}
for (i=0; i < n; i++){
var F=(ns)?document.layers['nsFace'+i]:ieFace[i].style;
F.top=y[i] + ClockHeight*Math.sin(-1.0471 + i*Split*Math.PI/180)+scrll;
F.left=x[i] + ClockWidth*Math.cos(-1.0471 + i*Split*Math.PI/180);
}
for (i=0; i < H.length; i++){
var HL=(ns)?document.layers['nsHours'+i]:ieHours[i].style;
HL.top=y[i]+HandY+(i*HandHeight)*Math.sin(hrs)+scrll;
HL.left=x[i]+HandX+(i*HandWidth)*Math.cos(hrs);
}
for (i=0; i < M.length; i++){
var ML=(ns)?document.layers['nsMinutes'+i]:ieMinutes[i].style;
ML.top=y[i]+HandY+(i*HandHeight)*Math.sin(min)+scrll;
ML.left=x[i]+HandX+(i*HandWidth)*Math.cos(min);
}
for (i=0; i < S.length; i++){
var SL=(ns)?document.layers['nsSeconds'+i]:ieSeconds[i].style;
SL.top=y[i]+HandY+(i*HandHeight)*Math.sin(sec)+scrll;
SL.left=x[i]+HandX+(i*HandWidth)*Math.cos(sec);
}
for (i=0; i < D.length; i++){
var DL=(ns)?document.layers['nsDate'+i]:ieDate[i].style;
DL.top=Dy[i] + ClockHeight*1.5*Math.sin(currStep+i*Dsplit*Math.PI/180)+scrll;
DL.left=Dx[i] + ClockWidth*1.5*Math.cos(currStep+i*Dsplit*Math.PI/180);
}
currStep-=step;
}
function Delay(){
scrll=(ns)?window.pageYOffset:0;
Dy[0]=Math.round(DY[0]+=((ymouse)-DY[0])*speed);
Dx[0]=Math.round(DX[0]+=((xmouse)-DX[0])*speed);
for (i=1; i < D.length; i++){
Dy[i]=Math.round(DY[i]+=(Dy[i-1]-DY[i])*speed);
Dx[i]=Math.round(DX[i]+=(Dx[i-1]-DX[i])*speed);
}
y[0]=Math.round(Y[0]+=((ymouse)-Y[0])*speed);
x[0]=Math.round(X[0]+=((xmouse)-X[0])*speed);
for (i=1; i < n; i++){
y[i]=Math.round(Y[i]+=(y[i-1]-Y[i])*speed);
x[i]=Math.round(X[i]+=(x[i-1]-X[i])*speed);
}
ClockAndAssign();
setTimeout('Delay()',20);
}
if (ns||ie)window.onload=Delay;
</SCRIPT>

带倒影的时钟
<title> 带有倒影的时间 </title>
<html>
<head>
<style type="text/css">
<!--
.time{
 font-family : Comic Sans Ms;
 font-size : 14pt;
 font-weight : bold;
 color: #00008D;
}
-->
</style>
<style type="text/css">
<!--
.time{
 font-family : Comic Sans Ms;
 font-size : 14pt;
 font-weight : bold;
 color: #00008D;
}
-->
</style>
</head>
<script Language="JavaScript">
<!-- Hiding
var ctimer;

function init(){
if (document.all){
tim2.style.left=tim1.style.posLeft;
tim2.style.top=tim1.style.posTop+tim1.offsetHeight-6;
settimes();
}
}

function settimes(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
if (hours<10)
hours="0"+hours;
if(mins<10)
mins="0"+mins;
if (secs<10)
secs="0"+secs;
tim1.innerHTML=hours+":"+mins+":"+secs
tim2.innerHTML=hours+":"+mins+":"+secs
ctimer=setTimeout('settimes()',960);}
// -->
</script>
<body onLoad="init()">
<div align="center" Id="tim1" Style="position:absolute; width:10; height:10; top:10; left:50"
class="time"></div><div Id="tim2"
Style="position:absolute; filter:flipv() alpha(opacity=20); font-style:italic"
class="time"></div>
</body>
<script Language="JavaScript">
<!-- Hiding
var ctimer;

function init(){
if (document.all){
tim2.style.left=tim1.style.posLeft;
tim2.style.top=tim1.style.posTop+tim1.offsetHeight-6;
settimes();
}
}

function settimes(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
if (hours<10)
hours="0"+hours;
if(mins<10)
mins="0"+mins;
if (secs<10)
secs="0"+secs;
tim1.innerHTML=hours+":"+mins+":"+secs
tim2.innerHTML=hours+":"+mins+":"+secs
ctimer=setTimeout('settimes()',960);
}
// -->
 </script>
</html>
<div id="Layer551" style="position:absolute; left:585px; top:6px; width:200px; height:52px; z-index:1">

农历时间显示
<script language="JavaScript">
var bsYear;
var bsDate;
var bsWeek;
var arrLen=8;  //数组长度
var sValue=0;  //当年的秒数
var dayiy=0;  //当年第几天
var miy=0;  //月份的下标
var iyear=0;  //年份标记
var dayim=0;  //当月第几天
var 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]="丙戌年";
var D=new Date();
var yy=D.getYear();
var mm=D.getMonth()+1;
var dd=D.getDate();
var 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>";
ww=ww;
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+"月";
bsDate2=dd;
bsYear="农历"+Yn[iyear];
bsYear2=Mn[miy]+Dn[dayim-1];
if (ss>=Ys[7]||ss<Ys[0]) bsYear=Yn[7];
function time(){
document.write("<table border='0' style='font-size: 8pt; font-family:Tahoma' cellspacing='0' width='90' bordercolor='#cccccc' height='110' cellpadding='0'");
document.write("<tr><td align='center' style='border: 1 solid #0099ff;padding-top:4px'><b><font color=#3366cc>"+bsDate+"</font><br><span style='font-family: Arial Black;font-size:18pt;color:#FF0000'>"+bsDate2+"</span><br><br><span style='FONT-SIZE: 10.5pt;color:#000000'>");
document.write(bsWeek+"</span><br>"+"<hr width='60' ></b><font color=#666666>");
document.write(bsYear+"<br>"+bsYear2+"</td></tr></table>");
}
</script>

<script>time()</script>

windows格式日期表
<style type="text/css">
body {
 background-color: #D4D0C8;
}
.m_fieldset {
 padding: 0,10,5,10;
 text-align: center;
 width: 150px;
}
.m_legend {
 font-family: Tahoma;
 font-size: 11px;
 padding-bottom: 5px;
}
.m_frameborder {
 border-left: 2px inset #D4D0C8;
 border-top: 2px inset #D4D0C8;
 border-right: 2px inset #FFFFFF;
 border-bottom: 2px inset #FFFFFF;
 width: 100px;
 height: 19px;
 background-color: #FFFFFF;
 overflow: hidden;
 text-align: right;
 font-family: "Tahoma";
 font-size: 10px;
}
.m_arrow {
 width: 16px;
 height: 8px;
 font-family: "Webdings";
 font-size: 7px;
 line-height: 2px;
 padding-left: 2px;
 cursor: default;
}
.m_input {
 width: 18px;
 height: 14px;
 border: 0px solid black;
 font-family: "Tahoma";
 font-size: 9px;
 text-align: right;
 ime-mode:disabled;
}
</style>

<script language="javascript">
// Written by cloudchen, 2004/03/15
function minute(name,fName)
{
 this.name = name;
 this.fName = fName || "m_input";
 this.timer = null;
 this.fObj = null;
 
 this.toString = function()
 {
 var objDate = new Date();
 var sMinute_Common = "class=/"m_input/" maxlength=/"2/" name=/""+this.fName+"/" onfocus=/""+this.name+".setFocusObj(this)/" onblur=/""+this.name+".setTime(this)/" onkeyup=/""+this.name+".prevent(this)/" onkeypress=/"if (!/[0-9]/.test(String.fromCharCode(event.keyCode)))event.keyCode=0/" onpaste=/"return false/" ondragenter=/"return false/"";
 var sButton_Common = "class=/"m_arrow/" onfocus=/"this.blur()/" onmouseup=/""+this.name+".controlTime()/" disabled"
 var str = "";
 str += "<table border=/"0/" cellspacing=/"0/" cellpadding=/"0/">"
 str += "<tr>"
 str += "<td>"
 str += "<div class=/"m_frameborder/">"
 str += "<input radix=/"24/" value=/""+this.formatTime(objDate.getHours())+"/" "+sMinute_Common+">:"
 str += "<input radix=/"60/" value=/""+this.formatTime(objDate.getMinutes())+"/" "+sMinute_Common+">:"
 str += "<input radix=/"60/" value=/""+this.formatTime(objDate.getSeconds())+"/" "+sMinute_Common+">"
 str += "</div>"
 str += "</td>"
 str += "<td>"
 str += "<table border=/"0/" cellspacing=/"2/" cellpadding=/"0/">"
 str += "<tr><td><button id=/""+this.fName+"_up/" "+sButton_Common+">5</button></td></tr>"
 str += "<tr><td><button id=/""+this.fName+"_down/" "+sButton_Common+">6</button></td></tr>"
 str += "</table>"
 str += "</td>"
 str += "</tr>"
 str += "</table>"
 return str;
 }
 this.play = function()
 {
 this.timer = setInterval(this.name+".playback()",1000);
 }
 this.formatTime = function(sTime)
 {
 sTime = ("0"+sTime);
 return sTime.substr(sTime.length-2);
 }
 this.playback = function()
 {
 var objDate = new Date();
 var arrDate = [objDate.getHours(),objDate.getMinutes(),objDate.getSeconds()];
 var objMinute = document.getElementsByName(this.fName);
 for (var i=0;i<objMinute.length;i++)
 {
 objMinute[i].value = this.formatTime(arrDate[i])
 }
 }
 this.prevent = function(obj)
 {
 clearInterval(this.timer);
 this.setFocusObj(obj);
 var value = parseInt(obj.value,10);
 var radix = parseInt(obj.radix,10)-1;
 if (obj.value>radix||obj.value<0)
 {
 obj.value = obj.value.substr(0,1);
 }
 }
 this.controlTime = function(cmd)
 {
 event.cancelBubble = true;
 if (!this.fObj) return;
 clearInterval(this.timer);
 var cmd = event.srcElement.innerText=="5"?true:false;
 var i = parseInt(this.fObj.value,10);
 var radix = parseInt(this.fObj.radix,10)-1;
 if (i==radix&&cmd)
 {
 i = 0;
 }
 else if (i==0&&!cmd)
 {
 i = radix;
 }
 else
 {
 cmd?i++:i--;
 }
 this.fObj.value = this.formatTime(i);
 this.fObj.select();
 }
 this.setTime = function(obj)
 {
 obj.value = this.formatTime(obj.value);
 }
 this.setFocusObj = function(obj)
 {
 eval(this.fName+"_up").disabled = eval(this.fName+"_down").disabled = false;
 this.fObj = obj;
 }
 this.getTime = function()
 {
 var arrTime = new Array(2);
 for (var i=0;i<document.getElementsByName(this.fName).length;i++)
 {
 arrTime[i] = document.getElementsByName(this.fName)[i].value;
 }
 return arrTime.join(":");
 }
}
</script>

<style type="text/css">
body {
 background-color: #D4D0C8;
}
.c_fieldset {
 padding: 0,10,5,10;
 text-align: center;
 width: 180px;
}
.c_legend {
 font-family: Tahoma;
 font-size: 11px;
 padding-bottom: 5px;
}
.c_frameborder {
 border-left: 2px inset #D4D0C8;
 border-top: 2px inset #D4D0C8;
 border-right: 2px inset #FFFFFF;
 border-bottom: 2px inset #FFFFFF;
 background-color: #FFFFFF;
 overflow: hidden;
 font-family: "Tahoma";
 font-size: 10px;
 width:160px;
 height:120px;
}
.c_frameborder td {
 width: 23px;
 height: 16px;
 font-family: "Tahoma";
 font-size: 11px;
 text-align: center;
 cursor: default;
}
.c_frameborder .selected {
 background-color:#0A246A;
 width:12px;
 height:12px;
 color:white;
}
.c_frameborder span {
 width:12px;
 height:12px;
}
.c_arrow {
 width: 16px;
 height: 8px;
 font-family: "Webdings";
 font-size: 7px;
 line-height: 2px;
 padding-left: 2px;
 cursor: default;
}
.c_year {
 font-family: "Tahoma";
 font-size: 11px;
 cursor: default;
 width:55px;
 height:19px;
}
.c_month {
 width:75px;
 height:20px;
 font:11px "Tahoma";
}
.c_dateHead {
 background-color:#808080;
 color:#D4D0C8;
}
</style>

<script language="javascript">
// Written by cloudchen, 2004/03/16
function calendar(name,fName)
{
 this.name = name;
 this.fName = fName || "calendar";
 this.year = new Date().getFullYear();
 this.month = new Date().getMonth();
 this.date = new Date().getDate();
 //private
 this.toString = function()
 {
 var str = "";
 str += "<table border=/"0/" cellspacing=/"3/" cellpadding=/"0/" onselectstart=/"return false/">";
 str += "<tr>";
 str += "<td>";
 str += this.drawMonth();
 str += "</td>";
 str += "<td align=/"right/">";
 str += this.drawYear();
 str += "</td>";
 str += "</tr>";
 str += "<tr>";
 str += "<td colspan=/"2/">";
 str += "<div class=/"c_frameborder/">";
 str += "<table border=/"0/" cellspacing=/"0/" cellpadding=/"0/" class=/"c_dateHead/">";
 str += "<tr>";
 str += "<td>日</td><td>一</td><td>二</td><td>三</td><td>四</td><td>五</td><td>六</td>";
 str += "</tr>";
 str += "</table>";
 str += this.drawDate();
 str += "</div>";
 str += "</td>";
 str += "</tr>";
 str += "</table>";
 return str;
 }
 //private
 this.drawYear = function()
 {
 var str = "";
 str += "<table border=/"0/" cellspacing=/"0/" cellpadding=/"0/">";
 str += "<tr>";
 str += "<td>";
 str += "<input class=/"c_year/" maxlength=/"4/" value=/""+this.year+"/" name=/""+this.fName+"/" id=/""+this.fName+"_year/" readonly>";
 //DateField
 str += "<input type=/"hidden/" name=/""+this.fName+"/" value=/""+this.date+"/" id=/""+this.fName+"_date/">";
 str += "</td>";
 str += "<td>";
 str += "<table cellspacing=/"2/" cellpadding=/"0/" border=/"0/">";
 str += "<tr>";
 str += "<td><button class=/"c_arrow/" onfocus=/"this.blur()/" onclick=/"event.cancelBubble=true;document.getElementById('"+this.fName+"_year').value++;"+this.name+".redrawDate()/">5</button></td>";
 str += "</tr>";
 str += "<tr>";
 str += "<td><button class=/"c_arrow/" onfocus=/"this.blur()/" onclick=/"event.cancelBubble=true;document.getElementById('"+this.fName+"_year').value--;"+this.name+".redrawDate()/">6</button></td>";
 str += "</tr>";
 str += "</table>";
 str += "</td>";
 str += "</tr>";
 str += "</table>";
 return str;
 }
 //priavate
 this.drawMonth = function()
 {
 var aMonthName = ["一","二","三","四","五","六","七","八","九","十","十一","十二"];
 var str = "";
 str += "<select class=/"c_month/" name=/""+this.fName+"/" id=/""+this.fName+"_month/" onchange=/""+this.name+".redrawDate()/">";
 for (var i=0;i<aMonthName.length;i++) {
 str += "<option value=/""+(i+1)+"/" "+(i==this.month?"selected":"")+">"+aMonthName[i]+"月</option>";
 }
 str += "</select>";
 return str;
 }
 //private
 this.drawDate = function()
 {
 var str = "";
 var fDay = new Date(this.year,this.month,1).getDay();
 var fDate = 1-fDay;
 var lDay = new Date(this.year,this.month+1,0).getDay();
 var lDate = new Date(this.year,this.month+1,0).getDate();
 str += "<table border=/"0/" cellspacing=/"0/" cellpadding=/"0/" id=/""+this.fName+"_dateTable"+"/">";
 for (var i=1,j=fDate;i<7;i++)
 {
 str += "<tr>";
 for (var k=0;k<7;k++)
 {
 str += "<td><span"+(j==this.date?" class=/"selected/"":"")+" onclick=/""+this.name+".redrawDate(this.innerText)/">"+(isDate(j++))+"</span></td>";
 }
 str += "</tr>";
 }
 str += "</table>";
 return str;

 function isDate(n)
 {
 return (n>=1&&n<=lDate)?n:"";
 }
 }
 //public
 this.redrawDate = function(d)
 {
 this.year = document.getElementById(this.fName+"_year").value;
 this.month = document.getElementById(this.fName+"_month").value-1;
 this.date = d || this.date;
 document.getElementById(this.fName+"_year").value = this.year;
 document.getElementById(this.fName+"_month").selectedIndex = this.month;
 document.getElementById(this.fName+"_date").value = this.date;
 if (this.date>new Date(this.year,this.month+1,0).getDate()) this.date = new Date(this.year,this.month+1,0).getDate();
 document.getElementById(this.fName+"_dateTable").outerHTML = this.drawDate();
 }
 //public
 this.getDate = function(delimiter)
 {
 if (!delimiter) delimiter = "/";
 var aValue = [this.year,(this.month+1),this.date];
 return aValue.join(delimiter);
 }
}
</script>
<table border="0">
<tr><td>
<fieldset class="c_fieldset"><legend class="c_legend">日期(T)</legend>
<!-- 调用日历 -->
<script>
var c = new calendar("c");
document.write(c);
</script>
<!-- 调用日历 -->
</fieldset>
</td>
<td valign="top">
<fieldset class="m_fieldset"><legend class="m_legend">时间(T)</legend>
<!-- 调用时间钟 -->
<script>
var m = new minute("m");
m.play();
document.write(m);
</script>
<!-- 调用时间钟 -->
</fieldset>
</td></tr>
<tr>
<td colspan="2">
<button onclick="alert(c.getDate())" style="font:8px Webdings;width:15px;height:15px;line-height:6px;">4</button>
<button style="font:10px Arial;height:15px;height:16px;border:0px;" onfocus="this.blur()">GetDate</button>

<button onclick="alert(m.getTime())" style="font:8px Webdings;width:15px;height:15px;line-height:6px;">4</button>
<button style="font:10px Arial;height:15px;height:16px;border:0px;" onfocus="this.blur()">GetTime</button>
</td>
</tr>
</table>

灰色日历
<style type="text/css">
.body,td{
font-family:"Arial";
font-size:8pt;
color:#000000;
}
.TrOut{
background:#dddddd;
height:26;
border:1 solid #999999;
border-top-color:#f4f4f4;
border-left-color:#f4f4f4;
}
.TdOver{
background:#eeeeee;
height:20;
border:1 solid #ffffff;
border-top-color:#9c9c9c;
border-left-color:#9c9c9c;
}
.TdOut{
background:#eeeeee;
height:20;
border:1 solid #9c9c9c;
border-top-color:#ffffff;
border-left-color:#ffffff;
}
</style>
<script language="JScript">
/*********************************************************

函数 TableFunction 提供以下方法和属性:

1.GetDateStr()
返回指定年月的日期的数组,包括空字符.
参数:
y是指年
m是指月
调用方式:TableFunction().GetDateStr(Year,Month)

2.GetTableStr()
返回指定年月的已经格式化了的表格
参数:
y是指年
m是指月
调用方式:TableFunction().GetTableStr(Year,Month)

3.WriteSelect()
返回年月的选择框
参数:
obj是指需要加入选择框的容器
values是指需要加亮的项目
action是指参数,带入参数y表示是年选择框,带入参数m表示月选择框
getobj是指在哪个控件上触发的事件,其中true为非当前选择框触发
而false则为当前选择框触发
调用方式:TableFunction().WriteSelect(obj,values,action,getobj)

4.RewriteTableStr()
复位重写表格中的日期
参数:
y是指年
m是指月
调用方式:TableFunction().RewriteTableStr(Year,Month)

5.JumpToRun()
左右控制表格中的月变化
参数:
action表示日历是前进还是后退
调用方式:TableFunction().JumpToRun(action)

6.AlertDay()
提示当前点击的位置的日期
参数:

调用方式:TableFunction().AlertDay()
*********************************************************/
function TableFunction(){
 this.GetDateStr=function(y,m){
 this.DayArray=[];
 for(var i=0;i<42;i++)this.DayArray[i]=" ";
 for(var i=0;i<new Date(y,m,0).getDate();i++)this.DayArray[i+new Date(y,m-1,1).getDay()]=i+1;
 return this.DayArray;
 }
 this.GetTableStr=function(y,m){
 this.DateArray=["日","一","二","三","四","五","六"];
 this.DStr="<table oncontextmenu='return false' onselectstart='return false' style='width:160;cursor:default;border:1 solid #9c9c9c;border-right:0;border-bottom:0;filter:progid:dximagetransform.microsoft.dropshadow(color=#e3e3e3,offx=3,offy=3,positive=true)' border='0' cellpadding='0' cellspacing='0'>/n"+
 "<tr><td colspan='7' class='TrOut'>"+
 "<table width='100%' height='100%'border='0' cellpadding='0' cellspacing='0'><tr align='center'>/n"+
 "<td width='20' style='font-family:/"webdings/";font-size:9pt' onclick='TableFunction().JumpToRun(/"b/")' onmouseover='this.style.color=/"#ff9900/"' onmouseout='this.style.color=/"/"'>3</td>/n"+
 "<td id='YearTD' width='70' onmouseover='this.style.background=/"#cccccc/"' onmouseout='this.style.background=/"/"' onclick='TableFunction().WriteSelect(this,this.innerText.split(/" /")[0],/"y/",false)'>"+y+" 年</td>/n"+
 "<td id='MonthTD' width='47' onmouseover='this.style.background=/"#cccccc/"' onmouseout='this.style.background=/"/"' onclick='TableFunction().WriteSelect(this,this.innerText.split(/" /")[0],/"m/",false)'>"+m+" 月</td>/n"+
 "<td width='20' style='font-family:/"webdings/";font-size:9pt' onclick='TableFunction().JumpToRun(/"n/")' onmouseover='this.style.color=/"#ff9900/"' onmouseout='this.style.color=/"/"'>4</td></tr></table>/n"+
 "</td></tr>/n"+
 "<tr align='center'>/n";
 for(var i=0;i<7;i++)
 this.DStr+="<td class='TrOut'>"+DateArray[i]+"</td>/n";
 this.DStr+="</tr>/n";
 for(var i=0;i<6;i++){
 this.DStr+="<tr align='center'>/n";
 for(var j=0;j<7;j++){
 var CS=new Date().getDate()==this.GetDateStr(y,m)[i*7+j]?"TdOver":"TdOut";
 this.DStr+="<td id='TD' class='"+CS+"' cs='"+CS+"' onmouseover='this.className=/"TdOver/"' onmouseout='if(this.cs!=/"TdOver/")this.className=/"TdOut/"' onclick='TableFunction().AlertDay()'>"+this.GetDateStr(y,m)[i*7+j]+"</td>/n";
 }
 this.DStr+="</tr>/n";
 }
 this.DStr+="</tabe>";
 return this.DStr;
 }
 this.WriteSelect=function(obj,values,action,getobj){
 if(values=="")return;
 if(getobj){
 obj.innerHTML=values+(action=="y"?" 年":" 月");
 this.RewriteTableStr(YearTD.innerText.split(" ")[0],MonthTD.innerText.split(" ")[0]);
 return false;
 }
 var StrArray=[];
 if(action=="y"){
 for(var i=0;i<15;i++){
 var year=values-7+i;
 StrArray[i]="<option value='"+year+"' "+(values==year?"selected":"")+"> "+year+"年</option>/n";
 }
 obj.innerHTML="<select id='select1' style='width:67' onchange='TableFunction().WriteSelect(parentElement,this.value,/"y/",true)' onblur='YearTD.innerText=this.value+/" 年/"'>/n"+StrArray.join("")+"</select>";
 select1.focus();
 }
 if(action=="m"){
 for(var i=1;i<13;i++)
 StrArray[i]="<option value='"+i+"' "+(i==values?"selected":"")+"> "+i+"月</option>/n";
 obj.innerHTML="<select id='select2' style='width:47' onchange='TableFunction().WriteSelect(parentElement,this.value,/"m/",true)' onblur='MonthTD.innerText=this.value+/" 月/"'>/n"+StrArray.join("")+"</select>";
 select2.focus();
 }
 }
 this.RewriteTableStr=function(y,m){
 var TArray=this.GetDateStr(y,m);
 var len=TArray.length;
 for(var i=0;i<len;i++){
 TD[i].innerHTML=TArray[i];
 TD[i].className="TdOut";
 TD[i].cs="TdOut";
 if(new Date().getYear()==y&&new Date().getMonth()+1==m&&new Date().getDate()==TArray[i]){
 TD[i].className="TdOver";
 TD[i].cs="TdOver";
 }
 }
 }
 this.JumpToRun=function(action){
 var YearNO=YearTD.innerText.split(' ')[0];
 var MonthNO=MonthTD.innerText.split(' ')[0];
 if(action=="b"){
 if(MonthNO=="1"){
 MonthNO=13;
 YearNO=YearNO-1;
 }
 MonthTD.innerText=MonthNO-1+" 月";
 YearTD.innerText=YearNO+" 年";
 this.RewriteTableStr(YearNO,MonthNO-1);
 }
 if(action=="n"){
 if(MonthNO=="12"){
 MonthNO=0;
 YearNO=YearNO-(-1);
 }
 YearTD.innerText=YearNO+" 年";
 MonthTD.innerText=MonthNO-(-1)+" 月";
 this.RewriteTableStr(YearNO,MonthNO-(-1));
 }
 }
 this.AlertDay=function(){
 if(event.srcElement.innerText!=" ")
 alert(YearTD.innerText.split(' ')[0]+"年"+MonthTD.innerText.split(' ')[0]+"月"+event.srcElement.innerText+"日");
 }
 return this;
 }
document.write(TableFunction().GetTableStr(new Date().getYear(),new Date().getMonth()+1));
</script>

蓝色日历
<Script LANGUAGE="JavaScript">
 var months = new Array("一", "二", "三","四", "五", "六", "七", "八", "九","十", "十一", "十二");
 var daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31,30, 31, 30, 31);
 var days = new Array("日","一", "二", "三","四", "五", "六");
 var classTemp;
 var today=new getToday();
 var year=today.year;
 var month=today.month;
 var newCal;

 function getDays(month, year) {
 if (1 == month) return ((0 == year % 4) && (0 != (year % 100))) ||(0 == year % 400) ? 29 : 28;
 else return daysInMonth[month];
 }

 function getToday() {
 this.now = new Date();
 this.year = this.now.getFullYear();
 this.month = this.now.getMonth();
 this.day = this.now.getDate();
 }

 function Calendar() {
 newCal = new Date(year,month,1);
 today = new getToday();
 var day = -1;
 var startDay = newCal.getDay();
 var endDay=getDays(newCal.getMonth(), newCal.getFullYear());
 var daily = 0;
 if ((today.year == newCal.getFullYear()) &&(today.month == newCal.getMonth()))
 {
 day = today.day;
 }
 var caltable = document.all.caltable.tBodies.calendar;
 var intDaysInMonth =getDays(newCal.getMonth(), newCal.getFullYear());

 for (var intWeek = 0; intWeek < caltable.rows.length;intWeek++)
 for (var intDay = 0;intDay < caltable.rows[intWeek].cells.length;intDay++)
 {
 var cell = caltable.rows[intWeek].cells[intDay];
 var montemp=(newCal.getMonth()+1)<10?("0"+(newCal.getMonth()+1)):(newCal.getMonth()+1);
 if ((intDay == startDay) && (0 == daily)){ daily = 1;}
 var daytemp=daily<10?("0"+daily):(daily);
 var d="<"+newCal.getFullYear()+"-"+montemp+"-"+daytemp+">";
 if(day==daily) cell.className="DayNow";
 else if(intDay==6) cell.className = "DaySat";
 else if (intDay==0) cell.className ="DaySun";
 else cell.className="Day";
 if ((daily > 0) && (daily <= intDaysInMonth))
 {
 cell.innerText = daily;
 daily++;
 } else
 {
 cell.className="CalendarTD";
 cell.innerText = "";
 }
 }
 document.all.year.value=year;
 document.all.month.value=month+1;
 }

 function subMonth()
 {
 if ((month-1)<0)
 {
 month=11;
 year=year-1;
 } else
 {
 month=month-1;
 }
 Calendar();
 }

 function addMonth()
 {
 if((month+1)>11)
 {
 month=0;
 year=year+1;
 } else
 {
 month=month+1;
 }
 Calendar();
 }

 function setDate()
 {
 if (document.all.month.value<1||document.all.month.value>12)
 {
 alert("月的有效范围在1-12之间!");
 return;
 }
 year=Math.ceil(document.all.year.value);
 month=Math.ceil(document.all.month.value-1);
 Calendar();
 }
</Script>

<Script>
function buttonOver()
{
 var obj = window.event.srcElement;
 obj.runtimeStyle.cssText = "background-color:#FFFFFF";
// obj.className="Hover";
}

function buttonOut()
{
 var obj = window.event.srcElement;
 window.setTimeout(function(){obj.runtimeStyle.cssText = "";},300);
}
</Script>

<Style>
Input {font-family: verdana;font-size: 9pt;text-decoration: none;background-color: #FFFFFF;height: 20px;border: 1px solid #666666;color:#000000;}

.Calendar {font-family: verdana;text-decoration: none;width: 170;background-color: #C0D0E8;font-size: 9pt;border:0px dotted #1C6FA5;}
.CalendarTD {font-family: verdana;font-size: 7pt;color: #000000;background-color:#f6f6f6;height: 20px;width:11%;text-align: center;}

.Title {font-family: verdana;font-size: 11pt;font-weight: normal;height: 24px;text-align: center;color: #333333;text-decoration: none;background-color: #A4B9D7;border-top-width: 1px;border-right-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-bottom-style:1px;border-top-color: #999999;border-right-color: #999999;border-bottom-color: #999999;border-left-color: #999999;}

.Day {font-family: verdana;font-size: 7pt;color:#243F65;background-color: #E5E9F2;height: 20px;width:11%;text-align: center;}
.DaySat {font-family: verdana;font-size: 7pt;color:#FF0000;text-decoration: none;background-color:#E5E9F2;text-align: center;height: 18px;width: 12%;}
.DaySun {font-family: verdana;font-size: 7pt;color: #FF0000;text-decoration: none;background-color:#E5E9F2;text-align: center;height: 18px;width: 12%;}
.DayNow {font-family: verdana;font-size: 7pt;font-weight: bold;color: #000000;background-color: #FFFFFF;height: 20px;text-align: center;}

.DayTitle {font-family: verdana;font-size: 9pt;color: #000000;background-color: #C0D0E8;height: 20px;width:11%;text-align: center;}
.DaySatTitle {font-family: verdana;font-size: 9pt;color:#FF0000;text-decoration: none;background-color:#C0D0E8;text-align: center;height: 20px;width: 12%;}
.DaySunTitle {font-family: verdana;font-size: 9pt;color: #FF0000;text-decoration: none;background-color: #C0D0E8;text-align: center;height: 20px;width: 12%;}

.DayButton {font-family: Webdings;font-size: 9pt;font-weight: bold;color: #243F65;cursor:hand;text-decoration: none;}

</Style>

<table border="0" cellpadding="0" cellspacing="1" class="Calendar" id="caltable">
<thead>
 <tr align="center" valign="middle">
 <td colspan="7" class="Title">
 <a href="javaScript:subMonth();" title="上一月" Class="DayButton">3</a> <input name="year" type="text" size="4" maxlength="4" onkeydown="if (event.keyCode==13){setDate()}" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onpaste="this.value=this.value.replace(/[^0-9]/g,'')"> 年 <input name="month" type="text" size="1" maxlength="2" onkeydown="if (event.keyCode==13){setDate()}" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onpaste="this.value=this.value.replace(/[^0-9]/g,'')"> 月 <a href="JavaScript:addMonth();" title="下一月" Class="DayButton">4</a>
 </td>
 </tr>
 <tr align="center" valign="middle">
 <Script LANGUAGE="JavaScript">
 document.write("<TD class=DaySunTitle id=diary >" + days[0] + "</TD>");
 for (var intLoop = 1; intLoop < days.length-1;intLoop++)
 document.write("<TD class=DayTitle id=diary>" + days[intLoop] + "</TD>");
 document.write("<TD class=DaySatTitle id=diary>" + days[intLoop] + "</TD>");
 </Script>
 </TR>
</thead>
<TBODY border=1 cellspacing="0" cellpadding="0" ID="calendar" ALIGN=CENTER ONCLICK="getDiary()">
 <Script LANGUAGE="JavaScript">
 for (var intWeeks = 0; intWeeks < 6; intWeeks++)
 {
 document.write("<TR style='cursor:hand'>");
 for (var intDays = 0; intDays < days.length;intDays++) document.write("<TD class=CalendarTD onMouseover='buttonOver();' onMouseOut='buttonOut();'></TD>");
 document.write("</TR>");
 }
 </Script>
</TBODY>
</TABLE>
<Script LANGUAGE="JavaScript">
 Calendar();
</Script>

24小时制时间
<script language="JavaScript">
<!--

f1Col='ccccc0';//face colour.
f2Col='ccccc0';//face colour.
d1Col='ff0000';//dot colour.
d2Col='ff0000';//dot colour.

hCol='00ff00';//hours colour.
mCol='00ff00';//minutes colour.
sCol='00ff00';//seconds colour.
ClockHeight=50;
ClockWidth=50;

//Alter nothing below! Alignments will be lost!

h=10;
m=7;
s=7;

face24='06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 01 02 03 04 05';
face24=face24.split(' ');
n1=face24.length;
face12='15 20 25 30 35 40 45 50 55 0 5 10';
face12=face12.split(' ');
n2=face12.length;
p="<font face=Arial size=1 color=#"+f1Col+">";
p2="<font face=Arial size=1 color=#"+f2Col+">";

e=360/n1;
e2=360/n2
e3=360/60

HandHeight=ClockHeight/6;
HandWidth=ClockWidth/6;
y=0;
x=0;

ns6=(document.getElementById&&!document.all);
ns=(document.layers);
ie=(document.all);

if (ns){
for (i=0; i < n1; i++)
document.write('<layer name="nshour24'+i+'" top=0 left=0 height=15 width=15><center>'+p+face24[i]+'</font></center></layer>');
for (i=0; i < n1; i++)
document.write('<layer name=nsdots1'+i+' top=0 left=0 bgcolor='+d1Col+' clip="0,0,2,2"></layer>');
for (i=0; i < n2; i++)
document.write('<layer name="nshour12'+i+'" top=0 left=0 height=15 width=15><center>'+p2+face12[i]+'</font></center></layer>');
for (i=0; i < 12; i++)
document.write('<layer name=nsdots2'+i+' top=0 left=0 bgcolor='+d2Col+' clip="0,0,2,2"></layer>');
for (i=0; i < h; i++)
document.write('<layer name=nsH'+i+' top=0 left=0 bgcolor='+hCol+' clip="0,0,2,2"></layer>');
for (i=0; i < m; i++)
document.write('<layer name=nsM'+i+' top=0 left=0 bgcolor='+mCol+' clip="0,0,2,2"></layer>');
for (i=0; i < s; i++)
document.write('<layer name=nsS'+i+' top=0 left=0 bgcolor='+sCol+' clip="0,0,2,2"></layer>');
}
if (ie||document.getElementById){
for (i=0; i < n1; i++)
document.write('<div id="hour24'+i+'" style="position:absolute;top:0px;left:0px;width:15px;height:15px;text-align:center">'+p+face24[i]+'</font></div>');
for (i=0; i < n1; i++)
document.write('<div id="dots1'+i+'" style="position:absolute;top:0px;left:0px;width:2px;height:2px;font-size:2px;background:#'+d1Col+'"></div>');
for (i=0; i < n2; i++)
document.write('<div id="hour12'+i+'" style="position:absolute;top:0px;left:0px;width:15px;height:15px;text-align:center">'+p2+face12[i]+'</font></div>');
for (i=0; i < 12; i++)
document.write('<div id="dots2'+i+'" style="position:absolute;top:0px;left:0px;height:2px;width:2px;font-size:2px;background:#'+d2Col+'"></div>');
for (i=0; i < h; i++)
document.write('<div id="ieH'+i+'" style="position:absolute;top:0px;left:0px;width:2px;height:2px;font-size:2px;background:#'+hCol+'"></div>');
for (i=0; i < m; i++)
document.write('<div id="ieM'+i+'" style="position:absolute;top:0px;left:0px;width:2px;height:2px;font-size:2px;background:#'+mCol+'"></div>');
for (i=0; i < s; i++)
document.write('<div id="ieS'+i+'" style="position:absolute;top:0px;left:0px;width:2px;height:2px;font-size:2px;background:#'+sCol+'"></div>');
}

function Scroll(){
if (ns){
y=window.pageYOffset+window.innerHeight-ClockHeight*2;
x=window.pageXOffset+window.innerWidth-ClockWidth*2.3;
}
if (ns6){
y=window.pageYOffset+window.innerHeight-ClockHeight*2.1;
x=window.pageXOffset+window.innerWidth-ClockWidth*2.2;
}
if (ie){
y=document.body.scrollTop+window.document.body.clientHeight-ClockHeight*2;
x=document.body.scrollLeft+window.document.body.clientWidth-ClockWidth*2;
}
setTimeout('Scroll()',50);
}
Scroll();

function ClockAndAssign(){
time = new Date ();
secs = time.getSeconds();
sec = -1.57 + Math.PI * secs/30;
mins = time.getMinutes();
min = -1.57 + Math.PI * mins/30;
hr = time.getHours();
hrs = -1.57 + Math.PI * hr/12 + Math.PI*parseInt(time.getMinutes())/720;
for (i=0; i < s; i++){
 var cs=(ns)?document.layers['nsS'+i]:(ie)?document.all['ieS'+i].style:document.getElementById("ieS"+i).style;
 cs.top=y+(i*HandHeight)*Math.sin(sec);
 cs.left=x+(i*HandWidth)*Math.cos(sec);
}
for (i=0; i < m; i++){
 var cm=(ns)?document.layers['nsM'+i]:(ie)?document.all['ieM'+i].style:document.getElementById("ieM"+i).style;
 cm.top=y+(i*HandHeight)*Math.sin(min);
 cm.left=x+(i*HandWidth)*Math.cos(min);
}
for (i=0; i < h; i++){
 var ch=(ns)?document.layers['nsH'+i]:(ie)?document.all['ieH'+i].style:document.getElementById("ieH"+i).style;
 ch.top=y+(i*HandHeight)*Math.sin(hrs);
 ch.left=x+(i*HandWidth)*Math.cos(hrs);
}
for (i=0; i < 12; i++){
 var d2=(ns)?document.layers['nsdots2'+i]:(ie)?document.all['dots2'+i].style:document.getElementById("dots2"+i).style;
 d2.top=y + ClockHeight*Math.sin(-1.0471 + i*e2*Math.PI/180);
 d2.left=x + ClockWidth*Math.cos(-1.0471 + i*e2*Math.PI/180);
}
for (i=0; i < n2; i++){
 var h12=(ns)?document.layers['nshour12'+i]:(ie)?document.all['hour12'+i].style:document.getElementById("hour12"+i).style;
 h12.top=y-6 + ClockHeight*1.2*Math.sin(i*e2*Math.PI/180);
 h12.left=x-6 + ClockWidth*1.2*Math.cos(i*e2*Math.PI/180);
}
for (i=0; i < n1; i++){
 var d1=(ns)?document.layers['nsdots1'+i]:(ie)?document.all['dots1'+i].style:document.getElementById("dots1"+i).style;
 d1.top=y + ClockHeight*1.5*Math.sin(-1.0471 + i*e*Math.PI/180);
 d1.left=x + ClockWidth*1.5*Math.cos(-1.0471 + i*e*Math.PI/180);
}
for (i=0; i < n1; i++){
 var h24=(ns)?document.layers['nshour24'+i]:(ie)?document.all['hour24'+i].style:document.getElementById("hour24"+i).style;
 h24.top=y-6 + ClockHeight*1.7*Math.sin(i*e*Math.PI/180);
 h24.left=x-6 + ClockWidth*1.7*Math.cos(i*e*Math.PI/180);
}
setTimeout('ClockAndAssign()',500);
}
ClockAndAssign();
//-->
</script>
固定的长针为时针,短针为分针,转动的当然是秒针了

超强!温度计式样时间
<title> 温度计式样的时间 </title>
<SCRIPT language=javascript>
var cellwidth=10; // EACH "CELL" WIDTH IN PIXELS
var cellheight=10; // EACH "CELL" HEIGHT IN PIXELS
var fontsize=11; // FONT SIZE OF THE NUMBERS. SETTING THIS TOO BIG CAUSES UNDESIRED EFFECTS.
var fontcolor="080080"; // ENTER ANY HTML OR RGB COLOR CODE
var fontstyle="bold"; // ENTER EITHER BOLD, ITALICS, NONE
var oncolor="red"; // COLOR OF ACTIVE CELLS
var offcolor="lightgrey"; // COLOR OF INACTIVE CELLS

var NS4 = (navigator.appName.indexOf("Netscape")>=0 && parseFloat(navigator.appVersion) >= 4 && parseFloat(navigator.appVersion) < 5)? true : false;
var IE4 = (document.all)? true : false;
var NS6 = (parseFloat(navigator.appVersion) >= 5 && navigator.appName.indexOf("Netscape")>=0 )? true: false;
var binclk, now;
var t='<table cellspacing="1" cellpadding="0" border="0"><tr><td align="center"> </td>';
for(i=0;i<=58;i+=2)t+='<td align="left" colspan="2"><font style="font-size:'+fontsize+'px; font-weight:'+fontstyle+'; color: '+fontcolor+'">'+i+'<br> |</font></td>';
t+='<td> </td></tr><tr><td align="center"><font style="font-size:'+fontsize+'px; font-weight:'+fontstyle+'; color: '+fontcolor+'">时: </font></td>';
for(i=0;i<=23;i++){
t+='<td>';
t+=(NS4)? '<ilayer name="hrs'+i+'" height="'+cellheight+'" width="'+cellwidth+'" bgcolor="'+offcolor+'"></ilayer>' : '<div id="hrs'+i+'" style="position:relative; width:'+cellwidth+'px; font-size:1px; height:'+cellheight+'px; background-color:'+offcolor+'"></div>';
t+='</td>';
}
t+='<td colspan="36"><td> </td></tr><tr><td align="center"><font style="font-size:'+fontsize+'px; font-weight:'+fontstyle+'; color: '+fontcolor+'">分: </font></td>';
for(i=0;i<=59;i++){
t+='<td>';
t+=(NS4)? '<ilayer name="min'+i+'" width="'+cellwidth+'" height="'+cellheight+'" bgcolor="'+offcolor+'"></ilayer>' : '<div id="min'+i+'" style="position:relative; width:'+cellwidth+'px; font-size:1px; height:'+cellheight+'px; background-color:'+offcolor+'"></div>';
t+='</td>';
}
t+='<td> </td></tr><tr><td align="center"><font style="font-size:'+fontsize+'px; font-weight:'+fontstyle+'; color: '+fontcolor+'">秒: </font></td>';
for(i=0;i<=59;i++)
{
t+='<td>';
t+=(NS4)? '<ilayer name="sec'+i+'" width="'+cellwidth+'" height="'+cellheight+'" bgcolor="'+offcolor+'"></ilayer>' : '<div id="sec'+i+'" style="position:relative; width:'+cellwidth+'px; font-size:1px; height:'+cellheight+'px; background-color:'+offcolor+'"></div>';
t+='</td>';
}
t+='<td> </td></tr><tr><td> </td><td> </td>';
for(i=1;i<=59;i+=2)t+='<td align="left" colspan="2"><font style="font-size:'+fontsize+'px; font-weight:'+fontstyle+'; color: '+fontcolor+'"> |<br>'+i+'</font></td>';
t+='</tr></table>';
document.write(t);
function init(){
getvals();
for(i=0;i<=now.h;i++)setbgcolor('hrs'+i, oncolor);
for(i=0;i<=now.m;i++)setbgcolor('min'+i, oncolor);
for(i=0;i<=now.s;i++)setbgcolor('sec'+i, oncolor);
setInterval('setclock()', 100);
}
function getvals(){
now=new Date();
now.s=now.getSeconds();
now.h=now.getHours();
now.m=now.getMinutes();
}
function setclock(){
getvals();
if((now.h==0)&&(now.m==0)) for(i=1;i<=23;i++)setbgcolor('hrs'+i, offcolor);
if((now.s==0)&&(now.m==0)) for (i=1;i<=59;i++)setbgcolor('min'+i, offcolor);
if(now.s==0) for(i=1;i<=59;i++)setbgcolor('sec'+i, offcolor);
setbgcolor('hrs'+now.h, oncolor);
setbgcolor('min'+now.m, oncolor);
setbgcolor('sec'+now.s, oncolor);
}
function resize(){
if(NS4)history.go(0);
}
function setbgcolor(idstr, color){
if(IE4)document.all[idstr].style.backgroundColor=color;
if(NS4)document.layers[idstr].bgColor=color;
if(NS6)document.getElementById(idstr).style.backgroundColor=color;
}
window.onload=init;
window.onresize=resize;
</SCRIPT>
随“鼠”而动的表(Javascript)

[最后编辑于 dengbin, at 2007-01-11 15:01:52] 
http://www.sisco.com.cn/xbear/lbs/article.asp?id=77
posted @ 2007-02-11 15:18  springMVC3.1例子  阅读(196)  评论(0编辑  收藏  举报