万年历(hao123)代码
网上有很多类似的代码,比如网站:hao123,IP138、日梭万年历网络版 等等,不过日梭万年历相对比较详细,也可以看看另外一篇文章的介绍:
日梭万年历网络版:http://www.cnblogs.com/mq0036/p/4330366.html
下面的代码是从hao123网站上摘取的,把以下代码保存到记事本,修改扩展名为html,双击打开就可以看到效果.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- saved from url=(0014)about:internet -->
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<title>hao123万年历</title>
<meta content="hao123万年历" name=keywords>
<meta content=All name=robots>
<meta content="hao123万年历" name=description>
<meta http-equiv="x-ua-compatible" content="ie=7"/>
<style type="text/css">
p {fONT-FAMILY: 宋体; FONT-SIZE: 9pt;line-height:12pt:color:#000000}
TD {fONT-FAMILY: 宋体,simsun; FONT-SIZE: 9pt}
a:link{ color:#000000; text-decoration:none}
a:visited{COLOR: #000000; TEXT-DECORATION: none}
a:active{color:green;text-decoration:none}
a:hover{color:red;text-decoration:underline}
button{width:39px;height:21px;padding:2px;}
</style>
<script language=JavaScript>
<!--
var blnSummerTime = false;
/*****************************************************************************
日期资料
*****************************************************************************/
var lunarInfo=new Array(
0x04bd8,0x04ae0,0x0a570,0x054d5,0x0d260,0x0d950,0x16554,0x056a0,0x09ad0,0x055d2,
0x04ae0,0x0a5b6,0x0a4d0,0x0d250,0x1d255,0x0b540,0x0d6a0,0x0ada2,0x095b0,0x14977,
0x04970,0x0a4b0,0x0b4b5,0x06a50,0x06d40,0x1ab54,0x02b60,0x09570,0x052f2,0x04970,
0x06566,0x0d4a0,0x0ea50,0x06e95,0x05ad0,0x02b60,0x186e3,0x092e0,0x1c8d7,0x0c950,
0x0d4a0,0x1d8a6,0x0b550,0x056a0,0x1a5b4,0x025d0,0x092d0,0x0d2b2,0x0a950,0x0b557,
0x06ca0,0x0b550,0x15355,0x04da0,0x0a5b0,0x14573,0x052b0,0x0a9a8,0x0e950,0x06aa0,
0x0aea6,0x0ab50,0x04b60,0x0aae4,0x0a570,0x05260,0x0f263,0x0d950,0x05b57,0x056a0,
0x096d0,0x04dd5,0x04ad0,0x0a4d0,0x0d4d4,0x0d250,0x0d558,0x0b540,0x0b6a0,0x195a6,
0x095b0,0x049b0,0x0a974,0x0a4b0,0x0b27a,0x06a50,0x06d40,0x0af46,0x0ab60,0x09570,
0x04af5,0x04970,0x064b0,0x074a3,0x0ea50,0x06b58,0x055c0,0x0ab60,0x096d5,0x092e0,
0x0c960,0x0d954,0x0d4a0,0x0da50,0x07552,0x056a0,0x0abb7,0x025d0,0x092d0,0x0cab5,
0x0a950,0x0b4a0,0x0baa4,0x0ad50,0x055d9,0x04ba0,0x0a5b0,0x15176,0x052b0,0x0a930,
0x07954,0x06aa0,0x0ad50,0x05b52,0x04b60,0x0a6e6,0x0a4e0,0x0d260,0x0ea65,0x0d530,
0x05aa0,0x076a3,0x096d0,0x04bd7,0x04ad0,0x0a4d0,0x1d0b6,0x0d250,0x0d520,0x0dd45,
0x0b5a0,0x056d0,0x055b2,0x049b0,0x0a577,0x0a4b0,0x0aa50,0x1b255,0x06d20,0x0ada0,
0x14b63);
var solarMonth=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
var Gan=new Array("甲","乙","丙","丁","戊","己","庚","辛","壬","癸");
var Zhi=new Array("子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥");
var Animals=new Array("鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪");
var solarTerm = new Array("小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至");
var sTermInfo = new Array(0,21208,42467,63836,85337,107014,128867,150921,173149,195551,218072,240693,263343,285989,308563,331033,353350,375494,397447,419210,440795,462224,483532,504758);
var nStr1 = new Array('日','一','二','三','四','五','六','七','八','九','十');
var nStr2 = new Array('初','十','廿','卅','□');
var monthName = new Array("JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC");
//国历节日 *表示放假日
var sFtv = new Array(
"0101*元旦节",
"0202 世界湿地日",
"0210 国际气象节",
"0214 情人节",
"0301 国际海豹日",
"0303 全国爱耳日",
"0305 学雷锋纪念日",
"0308 妇女节",
"0312 植树节 孙中山逝世纪念日",
"0314 国际警察日",
"0315 消费者权益日",
"0317 中国国医节 国际航海日",
"0321 世界森林日 消除种族歧视国际日 世界儿歌日",
"0322 世界水日",
"0323 世界气象日",
"0324 世界防治结核病日",
"0325 全国中小学生安全教育日",
"0330 巴勒斯坦国土日",
"0401 愚人节 全国爱国卫生运动月(四月) 税收宣传月(四月)",
"0407 世界卫生日",
"0422 世界地球日",
"0423 世界图书和版权日",
"0424 亚非新闻工作者日",
"0429*劳动节假日",
"0430*劳动节假日",
"0501*劳动节",
"0504 青年节",
"0505 碘缺乏病防治日",
"0508 世界红十字日",
"0512 国际护士节",
"0515 国际家庭日",
"0517 国际电信日",
"0518 国际博物馆日",
"0520 全国学生营养日",
"0523 国际牛奶日",
"0531 世界无烟日",
"0601 国际儿童节",
"0605 世界环境保护日",
"0606 全国爱眼日",
"0617 防治荒漠化和干旱日",
"0623 国际奥林匹克日",
"0625 全国土地日",
"0626 国际禁毒日",
"0701 香港回归纪念日 中共诞辰 世界建筑日",
"0702 国际体育记者日",
"0707 抗日战争纪念日",
"0711 世界人口日",
"0730 非洲妇女日",
"0801 建军节",
"0808 中国男子节(爸爸节)",
"0815 抗日战争胜利纪念",
"0908 国际扫盲日 国际新闻工作者日",
"0909 毛-泽-东逝世纪念",
"0910 中国教师节",
"0914 世界清洁地球日",
"0916 国际臭氧层保护日",
"0918 九·一八事变纪念日",
"0920 国际爱牙日",
"0927 世界旅游日",
"0928 孔子诞辰",
"1001*国庆节 世界音乐日 国际老人节",
"1002*国庆节假日 国际和平与民主自由斗争日",
"1003*国庆节假日",
"1004 世界动物日",
"1006 老人节",
"1008 全国高血压日 世界视觉日",
"1009 世界邮政日 万国邮联日",
"1010 辛亥革命纪念日 世界精神卫生日",
"1013 世界保健日 国际教师节",
"1014 世界标准日",
"1015 国际盲人节(白手杖节)",
"1016 世界粮食日",
"1017 世界消除贫困日",
"1022 世界传统医药日",
"1024 联合国日",
"1031 世界勤俭日",
"1107 十月社会主义革命纪念日",
"1108 中国记者日",
"1109 全国消防安全宣传教育日",
"1110 世界青年节",
"1111 国际科学与和平周(本日所属的一周)",
"1112 孙中山诞辰纪念日",
"1114 世界糖尿病日",
"1117 国际大学生节 世界学生节",
"1120*彝族年",
"1121*彝族年 世界问候日 世界电视日",
"1122*彝族年",
"1129 国际声援巴勒斯坦人民国际日",
"1201 世界艾滋病日",
"1203 世界残疾人日",
"1205 国际经济和社会发展志愿人员日",
"1208 国际儿童电视日",
"1209 世界足球日",
"1210 世界人权日",
"1212 西安事变纪念日",
"1213 南京大屠杀(1937年)纪念日!紧记血泪史!",
"1220 澳门回归纪念",
"1221 国际篮球日",
"1224 平安夜",
"1225 圣诞节",
"1226 毛-泽-东诞辰纪念")
//农历节日 *表示放假日
var lFtv = new Array(
"0101*春节",
"0102*初二",
"0103*初三",
"0115 元宵节",
"0505 端午节",
"0707 七夕情人节",
"0715 中元节",
"0815 中秋节",
"0909 重阳节",
"1208 腊八节",
"1223 小年",
"0100 除夕")
//某月的第几个星期几
var wFtv = new Array(
"0150 世界麻风日", //一月的最后一个星期日(月倒数第一个星期日)
"0520 国际母亲节",
"0530 全国助残日",
"0630 父亲节",
"0730 被奴役国家周",
"0932 国际和平日",
"0940 国际聋人节 世界儿童日",
"0950 世界海事日",
"1011 国际住房日",
"1013 国际减轻自然灾害日(减灾日)",
"1144 感恩节")
/*****************************************************************************
日期计算
*****************************************************************************/
//====================================== 返回农历 y年的总天数
function lYearDays(y) {
var i, sum = 348;
for(i=0x8000; i>0x8; i>>=1) sum += (lunarInfo[y-1900] & i)? 1: 0;
return(sum+leapDays(y));
}
//====================================== 返回农历 y年闰月的天数
function leapDays(y) {
if(leapMonth(y)) return((lunarInfo[y-1900] & 0x10000)? 30: 29);
else return(0);
}
//====================================== 返回农历 y年闰哪个月 1-12 , 没闰返回 0
function leapMonth(y) {
return(lunarInfo[y-1900] & 0xf);
}
//====================================== 返回农历 y年m月的总天数
function monthDays(y,m) {
return( (lunarInfo[y-1900] & (0x10000>>m))? 30: 29 );
}
//====================================== 算出农历, 传入日期控件, 返回农历日期控件
// 该控件属性有 .year .month .day .isLeap
function Lunar(objDate) {
var i, leap=0, temp=0;
var offset = (Date.UTC(objDate.getFullYear(),objDate.getMonth(),objDate.getDate()) - Date.UTC(1900,0,31))/86400000;
for(i=1900; i<2050 && offset>0; i++) { temp=lYearDays(i); offset-=temp; }
if(offset<0) { offset+=temp; i--; }
this.year = i;
leap = leapMonth(i); //闰哪个月
this.isLeap = false;
for(i=1; i<13 && offset>0; i++) {
//闰月
if(leap>0 && i==(leap+1) && this.isLeap==false)
{ --i; this.isLeap = true; temp = leapDays(this.year); }
else
{ temp = monthDays(this.year, i); }
//解除闰月
if(this.isLeap==true && i==(leap+1)) this.isLeap = false;
offset -= temp;
}
if(offset==0 && leap>0 && i==leap+1)
if(this.isLeap)
{ this.isLeap = false; }
else
{ this.isLeap = true; --i; }
if(offset<0){ offset += temp; --i; }
this.month = i;
this.day = offset + 1;
}
//==============================返回公历 y年某m+1月的天数
function solarDays(y,m) {
if(m==1)
return(((y%4 == 0) && (y%100 != 0) || (y%400 == 0))? 29: 28);
else
return(solarMonth[m]);
}
//============================== 传入 offset 返回干支, 0=甲子
function cyclical(num) {
return(Gan[num%10]+Zhi[num%12]);
}
//============================== 阴历属性
function calElement(sYear,sMonth,sDay,week,lYear,lMonth,lDay,isLeap,cYear,cMonth,cDay) {
this.isToday = false;
//瓣句
this.sYear = sYear; //公元年4位数字
this.sMonth = sMonth; //公元月数字
this.sDay = sDay; //公元日数字
this.week = week; //星期, 1个中文
//农历
this.lYear = lYear; //公元年4位数字
this.lMonth = lMonth; //农历月数字
this.lDay = lDay; //农历日数字
this.isLeap = isLeap; //是否为农历闰月?
//八字
this.cYear = cYear; //年柱, 2个中文
this.cMonth = cMonth; //月柱, 2个中文
this.cDay = cDay; //日柱, 2个中文
this.color = '';
this.lunarFestival = ''; //农历节日
this.solarFestival = ''; //公历节日
this.solarTerms = ''; //节气
}
//===== 某年的第n个节气为几日(从0小寒起算)
function sTerm(y,n) {
var offDate = new Date( ( 31556925974.7*(y-1900) + sTermInfo[n]*60000 ) + Date.UTC(1900,0,6,2,5) );
return(offDate.getUTCDate());
}
//============================== 返回阴历控件 (y年,m+1月)
/*
功能说明: 返回整个月的日期资料控件
使用方式: OBJ = new calendar(年,零起算月);
OBJ.length 返回当月最大日
OBJ.firstWeek 返回当月一日星期
由 OBJ[日期].属性名称 即可取得各项值
OBJ[日期].isToday 返回是否为今日 true 或 false
其他 OBJ[日期] 属性参见 calElement() 中的注解
*/
function calendar(y,m) {
var sDObj, lDObj, lY, lM, lD=1, lL, lX=0, tmp1, tmp2, tmp3;
var cY, cM, cD; //年柱,月柱,日柱
var lDPOS = new Array(3);
var n = 0;
var firstLM = 0;
sDObj = new Date(y,m,1,0,0,0,0); //当月一日日期
this.length = solarDays(y,m); //公历当月天数
this.firstWeek = sDObj.getDay(); //公历当月1日星期几
////////年柱 1900年立春后为庚子年(60进制36)
if(m<2) cY=cyclical(y-1900+36-1);
else cY=cyclical(y-1900+36);
var term2=sTerm(y,2); //立春日期
////////月柱 1900年1月小寒以前为 丙子月(60进制12)
var firstNode = sTerm(y,m*2) //返回当月「节」为几日开始
cM = cyclical((y-1900)*12+m+12);
//当月一日与 1900/1/1 相差天数
//1900/1/1与 1970/1/1 相差25567日, 1900/1/1 日柱为甲戌日(60进制10)
var dayCyclical = Date.UTC(y,m,1,0,0,0,0)/86400000+25567+10;
for(var i=0;i<this.length;i++) {
if(lD>lX) {
sDObj = new Date(y,m,i+1); //当月一日日期
lDObj = new Lunar(sDObj); //农历
lY = lDObj.year; //农历年
lM = lDObj.month; //农历月
lD = lDObj.day; //农历日
lL = lDObj.isLeap; //农历是否闰月
lX = lL? leapDays(lY): monthDays(lY,lM); //农历当月最后一天
if(n==0) firstLM = lM;
lDPOS[n++] = i-lD+1;
}
//依节气调整二月分的年柱, 以立春为界
if(m==1 && (i+1)==term2) cY=cyclical(y-1900+36);
//依节气月柱, 以「节」为界
if((i+1)==firstNode) cM = cyclical((y-1900)*12+m+13);
//日柱
cD = cyclical(dayCyclical+i);
//sYear,sMonth,sDay,week,
//lYear,lMonth,lDay,isLeap,
//cYear,cMonth,cDay
this[i] = new calElement(y, m+1, i+1, nStr1[(i+this.firstWeek)%7],
lY, lM, lD++, lL,
cY ,cM, cD );
}
//节气
tmp1=sTerm(y,m*2 )-1;
tmp2=sTerm(y,m*2+1)-1;
this[tmp1].solarTerms = solarTerm[m*2];
this[tmp2].solarTerms = solarTerm[m*2+1];
if(m==3) this[tmp1].color = 'red'; //清明颜色
//公历节日
for(i in sFtv)
if(sFtv[i].match(/^(\d{2})(\d{2})([\s\*])(.+)$/))
if(Number(RegExp.$1)==(m+1)) {
this[Number(RegExp.$2)-1].solarFestival += RegExp.$4 + ' ';
if(RegExp.$3=='*') this[Number(RegExp.$2)-1].color = 'red';
}
//月周节日
for(i in wFtv)
if(wFtv[i].match(/^(\d{2})(\d)(\d)([\s\*])(.+)$/))
if(Number(RegExp.$1)==(m+1)) {
tmp1=Number(RegExp.$2);
tmp2=Number(RegExp.$3);
if(tmp1<5)
this[((this.firstWeek>tmp2)?7:0) + 7*(tmp1-1) + tmp2 - this.firstWeek].solarFestival += RegExp.$5 + ' ';
else {
tmp1 -= 5;
tmp3 = (this.firstWeek+this.length-1)%7; //当月最后一天星期?
this[this.length - tmp3 - 7*tmp1 + tmp2 - (tmp2>tmp3?7:0) - 1 ].solarFestival += RegExp.$5 + ' ';
}
}
//农历节日
for(i in lFtv)
if(lFtv[i].match(/^(\d{2})(.{2})([\s\*])(.+)$/)) {
tmp1=Number(RegExp.$1)-firstLM;
if(tmp1==-11) tmp1=1;
if(tmp1 >=0 && tmp1<n) {
tmp2 = lDPOS[tmp1] + Number(RegExp.$2) -1;
if( tmp2 >= 0 && tmp2<this.length && this[tmp2].isLeap!=true) {
this[tmp2].lunarFestival += RegExp.$4 + ' ';
if(RegExp.$3=='*') this[tmp2].color = 'red';
}
}
}
//复活节只出现在3或4月
if(m==2 || m==3) {
var estDay = new easter(y);
if(m == estDay.m)
this[estDay.d-1].solarFestival = this[estDay.d-1].solarFestival+' 复活节 Easter Sunday';
}
if(m==2) this[20].solarFestival = this[20].solarFestival+unescape('%20%u6D35%u8CE2%u751F%u65E5');
//黑色星期五
if((this.firstWeek+12)%7==5)
this[12].solarFestival += '黑色星期五';
//今日
if(y==tY && m==tM) this[tD-1].isToday = true;
}
//======================================= 返回该年的复活节(春分后第一次满月周后的第一主日)
function easter(y) {
var term2=sTerm(y,5); //取得春分日期
var dayTerm2 = new Date(Date.UTC(y,2,term2,0,0,0,0)); //取得春分的公历日期控件(春分一定出现在3月)
var lDayTerm2 = new Lunar(dayTerm2); //取得取得春分农历
if(lDayTerm2.day<15) //取得下个月圆的相差天数
var lMlen= 15-lDayTerm2.day;
else
var lMlen= (lDayTerm2.isLeap? leapDays(y): monthDays(y,lDayTerm2.month)) - lDayTerm2.day + 15;
//一天等于 1000*60*60*24 = 86400000 毫秒
var l15 = new Date(dayTerm2.getTime() + 86400000*lMlen ); //求出第一次月圆为公历几日
var dayEaster = new Date(l15.getTime() + 86400000*( 7-l15.getUTCDay() ) ); //求出下个周日
this.m = dayEaster.getUTCMonth();
this.d = dayEaster.getUTCDate();
}
//====================== 中文日期
function cDay(d){
var s;
switch (d) {
case 10:
s = '初十'; break;
case 20:
s = '二十'; break;
break;
case 30:
s = '三十'; break;
break;
default :
s = nStr2[Math.floor(d/10)];
s += nStr1[d%10];
}
return(s);
}
///////////////////////////////////////////////////////////////////////////////
var cld;
function drawCld(SY,SM) {
var i,sD,s,size;
cld = new calendar(SY,SM);
if(SY>1874 && SY<1909) yDisplay = '光绪' + (((SY-1874)==1)?'元':SY-1874);
if(SY>1908 && SY<1912) yDisplay = '宣统' + (((SY-1908)==1)?'元':SY-1908);
if(SY>1911) yDisplay = '建国' + (((SY-1949)==1)?'元':SY-1949);
GZ.innerHTML = yDisplay +'年 农历 ' + cyclical(SY-1900+36) + '年 【'+Animals[(SY-4)%12]+'年】';
YMBG.innerHTML = " " + SY + "<BR> " + monthName[SM];
for(i=0;i<42;i++) {
sObj=eval('SD'+ i);
lObj=eval('LD'+ i);
sObj.className = '';
sD = i - cld.firstWeek;
if(sD>-1 && sD<cld.length) { //日期内
sObj.innerHTML = sD+1;
if(cld[sD].isToday) sObj.className = 'todyaColor'; //今日颜色
sObj.style.color = cld[sD].color; //法定假日颜色
if(cld[sD].lDay==1) //显示农历月
lObj.innerHTML = '<b>'+(cld[sD].isLeap?'闰':'') + cld[sD].lMonth + '月' + (monthDays(cld[sD].lYear,cld[sD].lMonth)==29?'小':'大')+'</b>';
else //显示农历日
lObj.innerHTML = cDay(cld[sD].lDay);
s=cld[sD].lunarFestival;
if(s.length>0) { //农历节日
if(s.length>6) s = s.substr(0, 4)+'..';
s = s.fontcolor('red');
}
else { //公历节日
s=cld[sD].solarFestival;
if(s.length>0) {
size = (s.charCodeAt(0)>0 && s.charCodeAt(0)<128)?8:4;
if(s.length>size+2) s = s.substr(0, size)+'..';
s=(s=='黑色星期五')?s.fontcolor('black'):s.fontcolor('blue');
}
else { //廿四节气
s=cld[sD].solarTerms;
if(s.length>0) s = s.fontcolor('limegreen');
}
}
if(cld[sD].solarTerms=='清明') s = '清明节'.fontcolor('red');
if(cld[sD].solarTerms=='芒种') s = '芒种节'.fontcolor('red');
if(cld[sD].solarTerms=='夏至') s = '夏至节'.fontcolor('red');
if(cld[sD].solarTerms=='冬至') s = '冬至节'.fontcolor('red');
if(s.length>0) lObj.innerHTML = s;
}
else { //非日期
sObj.innerHTML = '';
lObj.innerHTML = '';
}
}
}
function changeCld() {
var y,m;
y=CLD.SY.selectedIndex+1900;
m=CLD.SM.selectedIndex;
drawCld(y,m);
}
function pushBtm(K) {
switch (K){
case 'YU' :
if(CLD.SY.selectedIndex>0) CLD.SY.selectedIndex--;
break;
case 'YD' :
if(CLD.SY.selectedIndex<150) CLD.SY.selectedIndex++;
break;
case 'MU' :
if(CLD.SM.selectedIndex>0) {
CLD.SM.selectedIndex--;
}
else {
CLD.SM.selectedIndex=11;
if(CLD.SY.selectedIndex>0) CLD.SY.selectedIndex--;
}
break;
case 'MD' :
if(CLD.SM.selectedIndex<11) {
CLD.SM.selectedIndex++;
}
else {
CLD.SM.selectedIndex=0;
if(CLD.SY.selectedIndex<150) CLD.SY.selectedIndex++;
}
break;
default :
CLD.SY.selectedIndex=tY-1900;
CLD.SM.selectedIndex=tM;
}
changeCld();
}
var Today = new Date();
var tY = Today.getFullYear();
var tM = Today.getMonth();
var tD = Today.getDate();
//////////////////////////////////////////////////////////////////////////////
var width = "130";
var offsetx = 2;
var offsety = 8;
var x = 0;
var y = 0;
var snow = 0;
var sw = 0;
var cnt = 0;
var dStyle;
document.onmousemove = mEvn;
//显示详细日期资料
function mOvr(v) {
var s,festival;
var sObj=eval('SD'+ v);
var d=sObj.innerHTML-1;
//sYear,sMonth,sDay,week,
//lYear,lMonth,lDay,isLeap,
//cYear,cMonth,cDay
if(sObj.innerHTML!='') {
sObj.style.cursor = 's-resize';
if(cld[d].solarTerms == '' && cld[d].solarFestival == '' && cld[d].lunarFestival == '')
festival = '';
else
festival = '<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR="#CCFFCC"><TR><TD>'+
'<FONT COLOR="#000000" STYLE="font-size:9pt;">'+cld[d].solarTerms + ' ' + cld[d].solarFestival + ' ' + cld[d].lunarFestival+'</FONT></TD>'+
'</TR></TABLE>';
s= '<TABLE WIDTH="130" BORDER=0 CELLPADDING="2" CELLSPACING=0 BGCOLOR="#000066" style="filter:Alpha(opacity=80)"><TR><TD>' +
'<TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD ALIGN="right"><FONT COLOR="#ffffff" STYLE="font-size:9pt;">'+
cld[d].sYear+' 年 '+cld[d].sMonth+' 月 '+cld[d].sDay+' 日<br>星期'+cld[d].week+'<br>'+
'<font color="violet">农历'+(cld[d].isLeap?'闰 ':' ')+cld[d].lMonth+' 月 '+cld[d].lDay+' 日</font><br>'+
'<font color="yellow">'+cld[d].cYear+'年 '+cld[d].cMonth+'月 '+cld[d].cDay + '日</font>'+
'</FONT></TD></TR></TABLE>'+ festival +'</TD></TR></TABLE>';
document.all["detail"].innerHTML = s;
if (snow == 0) {
dStyle.left = x+offsetx-(width/2)+"px";
dStyle.top = y+offsety+"px";
dStyle.visibility = "visible";
snow = 1;
}
}
}
//清除详细日期资料
function mOut() {
if ( cnt >= 1 ) { sw = 0; }
if ( sw == 0 ) { snow = 0; if(dStyle)dStyle.visibility = "hidden";}
else cnt++;
}
//取得位置
function mEvn(e) {
e= e||window.event;
x=e.clientX;
y=e.clientY;
if (document.body.scrollLeft)
{x=event.x+document.body.scrollLeft; y=event.y+document.body.scrollTop;}
if (snow){
dStyle.left = x+offsetx-(width/2);
dStyle.top = y+offsety;
}
}
///////////////////////////////////////////////////////////////////////////
function changeTZ() {
CITY.innerHTML = CLD.TZ.value.substr(6)
setCookie("TZ",CLD.TZ.selectedIndex)
}
function tick() {
var today
today = new Date()
Clock.innerHTML = getCnDayString(today);
Clock2.innerHTML = getEnDayString(TimeAdd(new Date(today.toUTCString().slice(0,-4)), CLD.TZ.value))+(blnSummerTime?"<FONT STYLE='font-size:18pt;font-family:Wingdings; color:red'>R</FONT>":"");
setTimeout("tick()", 1000);
}
function setCookie(name, value) {
var today = new Date()
var expires = new Date()
expires.setTime(today.getTime() + 1000*60*60*24*365)
document.cookie = name + "=" + escape(value) + "; expires=" + expires.toGMTString()
}
function getCookie(Name) {
var search = Name + "="
if(document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if(offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset)
if(end == -1) end = document.cookie.length
return unescape(document.cookie.substring(offset, end))
}
else return ""
}
}
function getCnDayString (dtmDay) {
return dtmDay.getFullYear()+"年"+(dtmDay.getMonth()+1)+"月"+dtmDay.getDate()+"日 "+dtmDay.getHours()+":"+((dtmDay.getMinutes().toString().length==1)?"0":"")+dtmDay.getMinutes()+":"+((dtmDay.getSeconds().toString().length==1)?"0":"")+dtmDay.getSeconds();
}
function getEnDayString (dtmDay) {
return dtmDay.getFullYear()+"-"+(dtmDay.getMonth()+1)+"-"+dtmDay.getDate()+" "+dtmDay.getHours()+":"+((dtmDay.getMinutes().toString().length==1)?"0":"")+dtmDay.getMinutes()+":"+((dtmDay.getSeconds().toString().length==1)?"0":"")+dtmDay.getSeconds();
}
function TimeAdd (UTC,T) {
var PlusMinus, y;
if (T.charAt(0)=="-") {
PlusMinus = -1;
}
else {
PlusMinus = 1
}
//alert(UTC)
//UTC=UTC.slice(4,UTC.length-4);
//alert(UTC)
y=UTC.getFullYear();
UTC.setMinutes(UTC.getMinutes()-(-T.slice(1,3)*60-T.slice(3,5))*PlusMinus);
//alert(UTC)
//美国国会于2005年通过扩大日光节约时间法案,将原来开始时间从4月的第一个星期日,提早到3月的第二个星期日;结束时间则从10月的最后一个星期日,延长到11月的第一个星期日。
var dtmDaylightSavingBegin,dtmDaylightSavingEnd;
dtmDaylightSavingBegin = new Date(y,3,0);
dtmDaylightSavingBegin.setDate(dtmDaylightSavingBegin.getDate()+(7-dtmDaylightSavingBegin.getDay())%7+7);
dtmDaylightSavingEnd = new Date(y,10,0);
dtmDaylightSavingEnd.setDate(dtmDaylightSavingEnd.getDate()+(7-dtmDaylightSavingEnd.getDay())%7);
if (T.slice(5,6)=="*" && UTC>=dtmDaylightSavingBegin && UTC<=dtmDaylightSavingEnd) {
UTC.setHours(UTC.getHours()+1);
blnSummerTime = true;
}
return UTC;
}
/////////////////////////////////////////////////////////
function initial() {
if (navigator.userAgent.indexOf('MSIE')<0) {
document.getElementById("worldmap").innerHTML="";
}
dStyle = detail.style;
CLD.SY.selectedIndex=tY-1900;
CLD.SM.selectedIndex=tM;
drawCld(tY,tM);
pushBtm('');
CLD.TZ.selectedIndex=getCookie("TZ");
changeTZ();
tick();
}
//-->
</script>
<style>
.todyaColor {
BACKGROUND-COLOR: aqua
}
</style>
<meta content="MSHTML 6.00.2800.1505" name=GENERATOR>
</head>
<body leftmargin=0 topmargin=0>
<script language=JavaScript>
lck=0;
function r(hval)
{
if ( lck == 0 )
{
document.bgColor=hval;
}
}
</script>
<div id=detail style="POSITION: absolute">
</div>
<center>
<br>
<br>
<form name=CLD onsubmit="return false">
<table>
<tbody>
<tr>
<td valign=top align=middle>
<br>
<font style="FONT-SIZE: 9pt" size=2>本机时间:</font><br>
<font id=Clock face=Arial color=#000080 size=4 align="center"></font>
<p>
<!--时区 *表示自动调整为日光节约时间-->
<font style="FONT-SIZE: 9pt" size=2>
<select style="FONT-SIZE: 9pt" onchange=changeTZ() name=TZ>
<option value="-1200 安尼威土克、瓜甲兰" selected>国际换日线
<option value="-1100 中途岛、萨摩亚群岛">萨摩亚
<option value="-1000 夏威夷">夏威夷
<option value=-0900*阿拉斯加>阿拉斯加
<option value=-0800*太平洋时间(美加)、提亚纳>太平洋
<option value=-0700*亚历桑那>美国山区
<option value=-0700*山区时间(美加)>美加山区
<option value=-0600*萨克其万(加拿大)>加拿大中部
<option value=-0600*墨西哥市、塔克西卡帕>墨西哥
<option value=-0600*中部时间(美加)>美加中部
<option value=-0500*波哥大、里玛>南美洲太平洋
<option value=-0500*东部时间(美加)>美加东部
<option value=-0500*印第安纳(东部)>美东
<option value=-0400*加拉卡斯、拉帕兹>南美洲西部
<option value="-0400*大西洋时间 加拿大)">大西洋
<option value="-0330 新岛(加拿大东岸)">纽芬兰
<option value="-0300 波西尼亚">东南美洲
<option value="-0300 布鲁诺斯爱丽斯、乔治城">南美洲东部
<option value=-0200*大西洋中部>大西洋中部
<option value=-0100*亚速尔群岛、维德角群岛>亚速尔
<option value="+0000 格林威治时间、都柏林、爱丁堡、伦敦">英国夏令
<option value="+0000 莫洛维亚(赖比瑞亚)、卡萨布兰卡">格林威治标准
<option value="+0100 巴黎、马德里">罗马
<option value="+0100 布拉格, 华沙, 布达佩斯">中欧
<option value="+0100 柏林、斯德哥尔摩、罗马、伯恩、布鲁赛尔、维也纳">西欧
<option value="+0200 以色列">以色列
<option value=+0200*东欧>东欧
<option value=+0200*开罗>埃及
<option value=+0200*雅典、赫尔辛基、伊斯坦堡>GFT
<option value=+0200*赫拉雷、皮托里>南非
<option value=+0300*巴格达、科威特、奈洛比(肯亚)、里雅德(沙乌地)>沙乌地阿拉伯
<option value=+0300*莫斯科、圣彼得堡、贺占、窝瓦格瑞德>俄罗斯
<option value=+0330*德黑兰>伊朗
<option value=+0400*阿布达比(东阿拉伯)、莫斯凯、塔布理斯(乔治亚共和)>阿拉伯
<option value=+0430*喀布尔>阿富汗
<option value="+0500 伊斯兰马巴德、克洛奇、伊卡特林堡、塔须肯">西亚
<option value="+0530 孟买、加尔各答、马垂斯、新德里、可伦坡">印度
<option value="+0600 阿马提、达卡">中亚
<option value="+0700 曼谷、亚加达、胡志明市">曼谷
<option value="+0800 北京、重庆、黑龙江">中国
<option value="+0800 台湾、香港、新加坡">台北
<option value="+0900 东京、大阪、扎幌、汉城、亚库兹(东西伯利亚)">东京
<option value="+0930 达尔文">澳洲中部
<option value="+1000 布里斯本、墨尔本、席德尼">席德尼
<option value="+1000 霍巴特">塔斯梅尼亚
<option value="+1000 关岛、莫斯比港、海 威">西太平洋
<option value=+1100*马哥大、所罗门群岛、新卡伦多尼亚>太平洋中部
<option value="+1200 威灵顿、奥克兰">纽西兰
<option value="+1200 斐济、肯加塔、马歇尔群岛">斐济</option>
</select>
时间 </font><br>
<font id=Clock2 face=Arial color=#000080 size=4 align="center"></font><br>
<font style="FONT-SIZE: 120pt; COLOR: green; FONT-FAMILY:Webdings" id="worldmap">û</font><br>
<font id=CITY style="FONT-SIZE: 9pt; WIDTH: 150px; COLOR: blue; FONT-FAMILY: '新细明体'"></font>
</p>
</td>
<td align=middle>
<div style="Z-INDEX: -1; POSITION: absolute; TOP: 40px"><!--背景年月的位置和颜色-->
<font id=YMBG style="FONT-SIZE: 90pt; COLOR: #DDDDDD; FONT-FAMILY: 'Arial Black'"> 0000<br>
JUN</font>
</div>
<table border=0>
<tbody>
<tr>
<td bgcolor=#000080 colspan=7>
<font style="FONT-SIZE: 9pt" color=#ffffff size=2>公历
<select style="FONT-SIZE: 9pt" onchange=changeCld() name=SY>
<script language=JavaScript><!--
for(i=1900;i<2050;i++) document.write('<option>'+i)
//--></script>
</select>
年
<select style="FONT-SIZE: 9pt" onchange=changeCld() name=SM>
<script language=JavaScript><!--
for(i=1;i<13;i++) document.write('<option>'+i)
//--></script>
</select>
月 </font><font id=GZ face=标楷体 color=yellow size=3></font><br>
</td>
</tr>
<tr align=middle bgcolor=#e0e0e0>
<td width=60>
<font color=red>日</font>
</td>
<td width=60>
一
</td>
<td width=60>
二
</td>
<td width=60>
三
</td>
<td width=60>
四
</td>
<td width=60>
五
</td>
<td width=60>
<font color=green>六</font>
</td>
</tr>
<script language=JavaScript><!--
var gNum
for(i=0;i<6;i++) {
document.write('<tr align=center>')
for(j=0;j<7;j++) {
gNum = i*7+j
document.write('<td id="GD' + gNum +'" onMouseOver="mOvr(' + gNum +')" onMouseOut="mOut()"><font id="SD' + gNum +'" size=5 face="Arial Black"')
if(j == 0) document.write(' color=red')
if(j == 6)
if(i%2==1) document.write(' color=red')
else document.write(' color=green')
document.write(' TITLE=""> </font><br><font id="LD' + gNum + '" size=2 style="font-size:9pt"> </font></td>')
}
document.write('</tr>')
}
//--></script>
</tbody>
</table>
</td>
<td valign=top align=middle width=40>
<br>
<br>
<br>
<br>
<button style="FONT-SIZE: 9pt" onclick="pushBtm('YU')">年↑</button><br>
<button style="FONT-SIZE: 9pt" onclick="pushBtm('YD')">年↓</button>
<p>
<button style="FONT-SIZE: 9pt" onclick="pushBtm('MU')">月↑</button><br>
<button style="FONT-SIZE: 9pt" onclick="pushBtm('MD')">月↓</button>
<p>
<button style="FONT-SIZE: 9pt" onclick="pushBtm('')">今日</button>
</p>
</td>
</tr>
</tbody>
</table>
</form>
<p>
</p>
<hr width="90%" color=#cccccc noshade size=1>
<font style="FONT-SIZE: 9pt" face=ARIAL size=2>阳历中<font color=red>红色</font>/<font color=green>绿色</font><font color=black>表示节假日,农历中<font color=green>绿色</font>表示为24节气日,<font color=red>红色</font>表示为传统节日,<font color=blue>蓝色</font>则表示为公众节假日<br>
<script type="text/javascript">
<!--
initial()
//-->
</script>
</center>
<br>
<table align="center" border="0" cellpadding="3" cellspacing="0" width="700">
<tr>
<td align="center">
<b><font color="#008000"></font></b>
</td>
</tr>
</table>
</body>
</html>
把以上代码保存到记事本,修改扩展名为html,双击打开就可以看到效果.
当然,现在的IP138网站也有万年历了,多了假期,不过都是大同小异,万年历网址:http://qq.ip138.com/day/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- saved from url=(0014)about:internet -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>万年历查询 日历查询 农历查询 农历日历 老黄历 万年历表</title>
<meta content="农历; 阳历; 月历; 节日; 时区; 节气; 八字; 干支; 生肖; gregorian solar; chinese lunar; calendar;" name="keywords">
<meta content="All" name="robots">
<meta content="gregorian solar calendar and chinese lunar calendar" name="description">
<meta http-equiv="x-ua-compatible" content="ie=7"/>
<style type="text/css">
p {fONT-FAMILY: 宋体; FONT-SIZE: 9pt;line-height:12pt:color:#000000}
TD {fONT-FAMILY: 宋体,simsun; FONT-SIZE: 9pt}
a:link{ color:#000000; text-decoration:none}
a:visited{COLOR: #000000; TEXT-DECORATION: none}
a:active{color:green;text-decoration:none}
a:hover{color:red;text-decoration:underline}
button{width:39px;height:21px;padding:2px;}
.workN{color:red;}
.rest{color:green;}
.SD{font-family:"Arial Black";font-size:24px;}
.panel {border-bottom:1px solid #e5e5e5;border-collapse:collapse;margin-top:10px;}
.panel th{border:1px solid #e5e5e5;background-color:#f8f8f8;font-weight:normal;font-size:9pt;padding:3px 1px;}
.panel td{border:1px solid #e5e5e5;padding:3px 2px;word-break:break-all;text-align:center;}
</style>
<script language="JavaScript">
<!--
var blnSummerTime = false;
/*****************************************************************************
日期资料
*****************************************************************************/
var lunarInfo=new Array(
0x04bd8,0x04ae0,0x0a570,0x054d5,0x0d260,0x0d950,0x16554,0x056a0,0x09ad0,0x055d2,
0x04ae0,0x0a5b6,0x0a4d0,0x0d250,0x1d255,0x0b540,0x0d6a0,0x0ada2,0x095b0,0x14977,
0x04970,0x0a4b0,0x0b4b5,0x06a50,0x06d40,0x1ab54,0x02b60,0x09570,0x052f2,0x04970,
0x06566,0x0d4a0,0x0ea50,0x06e95,0x05ad0,0x02b60,0x186e3,0x092e0,0x1c8d7,0x0c950,
0x0d4a0,0x1d8a6,0x0b550,0x056a0,0x1a5b4,0x025d0,0x092d0,0x0d2b2,0x0a950,0x0b557,
0x06ca0,0x0b550,0x15355,0x04da0,0x0a5b0,0x14573,0x052b0,0x0a9a8,0x0e950,0x06aa0,
0x0aea6,0x0ab50,0x04b60,0x0aae4,0x0a570,0x05260,0x0f263,0x0d950,0x05b57,0x056a0,
0x096d0,0x04dd5,0x04ad0,0x0a4d0,0x0d4d4,0x0d250,0x0d558,0x0b540,0x0b6a0,0x195a6,
0x095b0,0x049b0,0x0a974,0x0a4b0,0x0b27a,0x06a50,0x06d40,0x0af46,0x0ab60,0x09570,
0x04af5,0x04970,0x064b0,0x074a3,0x0ea50,0x06b58,0x055c0,0x0ab60,0x096d5,0x092e0,
0x0c960,0x0d954,0x0d4a0,0x0da50,0x07552,0x056a0,0x0abb7,0x025d0,0x092d0,0x0cab5,
0x0a950,0x0b4a0,0x0baa4,0x0ad50,0x055d9,0x04ba0,0x0a5b0,0x15176,0x052b0,0x0a930,
0x07954,0x06aa0,0x0ad50,0x05b52,0x04b60,0x0a6e6,0x0a4e0,0x0d260,0x0ea65,0x0d530,
0x05aa0,0x076a3,0x096d0,0x04bd7,0x04ad0,0x0a4d0,0x1d0b6,0x0d250,0x0d520,0x0dd45,
0x0b5a0,0x056d0,0x055b2,0x049b0,0x0a577,0x0a4b0,0x0aa50,0x1b255,0x06d20,0x0ada0,
0x14b63);
var solarMonth=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
var Gan=new Array("甲","乙","丙","丁","戊","己","庚","辛","壬","癸");
var Zhi=new Array("子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥");
var Animals=new Array("鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪");
var solarTerm = new Array("小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至");
var sTermInfo = new Array(0,21208,42467,63836,85337,107014,128867,150921,173149,195551,218072,240693,263343,285989,308563,331033,353350,375494,397447,419210,440795,462224,483532,504758);
var nStr1 = new Array('日','一','二','三','四','五','六','七','八','九','十');
var nStr2 = new Array('初','十','廿','卅','□');
var monthName = new Array("JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC");
//国历节日 *表示放假日
var sFtv = new Array(
"0101*元旦节",
"0202 世界湿地日",
"0210 国际气象节",
"0214 情人节",
"0301 国际海豹日",
"0303 全国爱耳日",
"0305 学雷锋纪念日",
"0308 妇女节",
"0312 植树节 孙中山逝世纪念日",
"0314 国际警察日",
"0315 消费者权益日",
"0317 中国国医节 国际航海日",
"0321 世界森林日 消除种族歧视国际日 世界儿歌日",
"0322 世界水日",
"0323 世界气象日",
"0324 世界防治结核病日",
"0325 全国中小学生安全教育日",
"0330 巴勒斯坦国土日",
"0401 愚人节 全国爱国卫生运动月(四月) 税收宣传月(四月)",
"0407 世界卫生日",
"0422 世界地球日",
"0423 世界图书和版权日",
"0424 亚非新闻工作者日",
"0429*劳动节假日",
"0430*劳动节假日",
"0501*劳动节",
"0504 青年节",
"0505 碘缺乏病防治日",
"0508 世界红十字日",
"0512 国际护士节",
"0515 国际家庭日",
"0517 世界电信日",
"0518 国际博物馆日",
"0520 全国学生营养日",
"0522 国际生物多样性日",
"0523 国际牛奶日",
"0531 世界无烟日",
"0601 国际儿童节",
"0605 世界环境日",
"0606 全国爱眼日",
"0617 防治荒漠化和干旱日",
"0623 国际奥林匹克日",
"0625 全国土地日",
"0626 国际禁毒日",
"0701 香港回归纪念日 中共诞辰 世界建筑日",
"0702 国际体育记者日",
"0707 抗日战争纪念日",
"0711 世界人口日",
"0730 非洲妇女日",
"0801 建军节",
"0808 中国男子节(爸爸节)",
"0815 抗日战争胜利纪念",
"0908 国际扫盲日 国际新闻工作者日",
"0909 毛-泽-东逝世纪念",
"0910 中国教师节",
"0914 世界清洁地球日",
"0916 国际臭氧层保护日",
"0918 九·一八事变纪念日",
"0920 国际爱牙日",
"0927 世界旅游日",
"0928 孔子诞辰",
"1001*国庆节 世界音乐日 国际老人节",
"1002*国庆节假日 国际和平与民主自由斗争日",
"1003*国庆节假日",
"1004 世界动物日",
"1006 老人节",
"1008 全国高血压日 世界视觉日",
"1009 世界邮政日 万国邮联日",
"1010 辛亥革命纪念日 世界精神卫生日",
"1013 世界保健日 国际教师节",
"1014 世界标准日",
"1015 国际盲人节(白手杖节)",
"1016 世界粮食日",
"1017 世界消除贫困日",
"1022 世界传统医药日",
"1024 联合国日 世界发展信息日",
"1031 世界勤俭日",
"1107 十月社会主义革命纪念日",
"1108 中国记者日",
"1109 全国消防安全宣传教育日",
"1110 世界青年节",
"1111 国际科学与和平周(本日所属的一周)",
"1112 孙中山诞辰纪念日",
"1114 世界糖尿病日",
"1117 国际大学生节 世界学生节",
"1120*彝族年",
"1121*彝族年 世界问候日 世界电视日",
"1122*彝族年",
"1129 国际声援巴勒斯坦人民国际日",
"1201 世界艾滋病日",
"1203 世界残疾人日",
"1205 国际经济和社会发展志愿人员日",
"1208 国际儿童电视日",
"1209 世界足球日",
"1210 世界人权日",
"1212 西安事变纪念日",
"1213 南京大屠杀(1937年)纪念日!紧记血泪史!",
"1220 澳门回归纪念",
"1221 国际篮球日",
"1224 平安夜",
"1225 圣诞节",
"1226 毛-泽-东诞辰纪念")
//农历节日 *表示放假日
var lFtv = new Array(
"0101*春节",
"0102*初二",
"0103*初三",
"0115 元宵节",
"0202 龙抬头节",
"0323 妈祖生辰",
"0505 端午节",
"0707 七夕情人节",
"0715 中元节",
"0815 中秋节",
"0909 重阳节",
"1208 腊八节",
"1223 小年",
"0100 除夕")
//某月的第几个星期几
var wFtv = new Array(
"0110 黑人日",
"0150 世界麻风日", //一月的最后一个星期日(月倒数第一个星期日)
"0520 国际母亲节",
"0530 全国助残日",
"0630 父亲节",
"0730 被奴役国家周",
"0932 国际和平日",
"0940 国际聋人节 世界儿童日",
"0950 世界海事日",
"1011 国际住房日",
"1013 国际减轻自然灾害日(减灾日)",
"1144 感恩节")
//放假
var worktime = {};
worktime.y2011 = JSON.parse('{"d0402":{"w":"上班"},"d0403":{"w":"放假"},"d0404":{"w":"放假"},"d0405":{"w":"放假"},"d0430":{"w":"放假"},"d0501":{"w":"放假"},"d0502":{"w":"放假"},"d0604":{"w":"放假"},"d0605":{"w":"放假"},"d0606":{"w":"放假"},"d0910":{"w":"放假"},"d0911":{"w":"放假"},"d0912":{"w":"放假"},"d1001":{"w":"放假"},"d1002":{"w":"放假"},"d1003":{"w":"放假"},"d1004":{"w":"放假"},"d1005":{"w":"放假"},"d1006":{"w":"放假"},"d1007":{"w":"放假"},"d1008":{"w":"上班"},"d1009":{"w":"上班"},"d1231":{"w":"上班"}}');
worktime.y2012 = JSON.parse('{"d0101":{"w":"放假"},"d0102":{"w":"放假"},"d0103":{"w":"放假"},"d0121":{"w":"上班"},"d0122":{"w":"放假"},"d0123":{"w":"放假"},"d0124":{"w":"放假"},"d0125":{"w":"放假"},"d0126":{"w":"放假"},"d0127":{"w":"放假"},"d0128":{"w":"放假"},"d0129":{"w":"上班"},"d0331":{"w":"上班"},"d0401":{"w":"上班"},"d0402":{"w":"放假"},"d0403":{"w":"放假"},"d0404":{"w":"放假"},"d0428":{"w":"上班"},"d0429":{"w":"放假"},"d0430":{"w":"放假"},"d0501":{"w":"放假"},"d0622":{"w":"放假"},"d0623":{"w":"放假"},"d0624":{"w":"放假"},"d0929":{"w":"上班"},"d0930":{"w":"放假"},"d1001":{"w":"放假"},"d1002":{"w":"放假"},"d1003":{"w":"放假"},"d1004":{"w":"放假"},"d1005":{"w":"放假"},"d1006":{"w":"放假"},"d1007":{"w":"放假"}}');
worktime.y2013 = JSON.parse('{"d0101":{"w":"放假"},"d0102":{"w":"放假"},"d0103":{"w":"放假"},"d0105":{"w":"上班"},"d0106":{"w":"上班"},"d0209":{"w":"放假"},"d0210":{"w":"放假"},"d0211":{"w":"放假"},"d0212":{"w":"放假"},"d0213":{"w":"放假"},"d0214":{"w":"放假"},"d0215":{"w":"放假"},"d0216":{"w":"上班"},"d0217":{"w":"上班"},"d0404":{"w":"放假"},"d0405":{"w":"放假"},"d0406":{"w":"放假"},"d0407":{"w":"上班"},"d0427":{"w":"上班"},"d0428":{"w":"上班"},"d0429":{"w":"放假"},"d0430":{"w":"放假"},"d0501":{"w":"放假"},"d0608":{"w":"上班"},"d0609":{"w":"上班"},"d0610":{"w":"放假"},"d0611":{"w":"放假"},"d0612":{"w":"放假"},"d0919":{"w":"放假"},"d0920":{"w":"放假"},"d0921":{"w":"放假"},"d0922":{"w":"上班"},"d0929":{"w":"上班"},"d1001":{"w":"放假"},"d1002":{"w":"放假"},"d1003":{"w":"放假"},"d1004":{"w":"放假"},"d1005":{"w":"放假"},"d1006":{"w":"放假"},"d1007":{"w":"放假"},"d1012":{"w":"上班"}}');
worktime.y2014 = JSON.parse('{"d0101":{"w":"放假"},"d0126":{"w":"上班"},"d0131":{"w":"放假"},"d0201":{"w":"放假"},"d0202":{"w":"放假"},"d0203":{"w":"放假"},"d0204":{"w":"放假"},"d0205":{"w":"放假"},"d0206":{"w":"放假"},"d0208":{"w":"上班"},"d0405":{"w":"放假"},"d0407":{"w":"放假"},"d0501":{"w":"放假"},"d0502":{"w":"放假"},"d0503":{"w":"放假"},"d0504":{"w":"上班"},"d0602":{"w":"放假"},"d0908":{"w":"放假"},"d0928":{"w":"上班"},"d1001":{"w":"放假"},"d1002":{"w":"放假"},"d1003":{"w":"放假"},"d1004":{"w":"放假"},"d1005":{"w":"放假"},"d1006":{"w":"放假"},"d1007":{"w":"放假"},"d1011":{"w":"上班"}}');
worktime.y2015 = JSON.parse('{"d0101":{"w":"放假"},"d0102":{"w":"放假"},"d0103":{"w":"放假"},"d0104":{"w":"上班"},"d0215":{"w":"上班"},"d0218":{"w":"放假"},"d0219":{"w":"放假"},"d0220":{"w":"放假"},"d0221":{"w":"放假"},"d0222":{"w":"放假"},"d0223":{"w":"放假"},"d0224":{"w":"放假"},"d0228":{"w":"上班"},"d0405":{"w":"放假"},"d0406":{"w":"补休"},"d0501":{"w":"放假"},"d0620":{"w":"放假"},"d0622":{"w":"补休"},"d0903":{"w":"放假"},"d0904":{"w":"调休"},"d0906":{"w":"上班"},"d0927":{"w":"放假"},"d1001":{"w":"放假"},"d1002":{"w":"放假"},"d1003":{"w":"放假"},"d1004":{"w":"放假"},"d1005":{"w":"放假"},"d1006":{"w":"放假"},"d1007":{"w":"放假"},"d1010":{"w":"上班"}}');
worktime.y2016 = JSON.parse('{"d0101":{"w":"放假"},"d0102":{"w":"放假"},"d0103":{"w":"放假"},"d0206":{"w":"上班"},"d0207":{"w":"放假"},"d0208":{"w":"放假"},"d0209":{"w":"放假"},"d0210":{"w":"放假"},"d0211":{"w":"放假"},"d0212":{"w":"放假"},"d0213":{"w":"放假"},"d0214":{"w":"上班"},"d0402":{"w":"放假"},"d0403":{"w":"放假"},"d0404":{"w":"放假"},"d0430":{"w":"放假"},"d0501":{"w":"放假"},"d0502":{"w":"补休"},"d0609":{"w":"放假"},"d0610":{"w":"放假"},"d0611":{"w":"放假"},"d0612":{"w":"上班"},"d0915":{"w":"放假"},"d0916":{"w":"放假"},"d0917":{"w":"放假"},"d0918":{"w":"上班"},"d1001":{"w":"放假"},"d1002":{"w":"放假"},"d1003":{"w":"放假"},"d1004":{"w":"放假"},"d1005":{"w":"放假"},"d1006":{"w":"放假"},"d1007":{"w":"放假"},"d1008":{"w":"上班"},"d1009":{"w":"上班"}}');
/*****************************************************************************
日期计算
*****************************************************************************/
//====================================== 返回农历 y年的总天数
function lYearDays(y) {
var i, sum = 348;
for(i=0x8000; i>0x8; i>>=1) sum += (lunarInfo[y-1900] & i)? 1: 0;
return(sum+leapDays(y));
}
//====================================== 返回农历 y年闰月的天数
function leapDays(y) {
if(leapMonth(y)) return((lunarInfo[y-1900] & 0x10000)? 30: 29);
else return(0);
}
//====================================== 返回农历 y年闰哪个月 1-12 , 没闰返回 0
function leapMonth(y) {
return(lunarInfo[y-1900] & 0xf);
}
//====================================== 返回农历 y年m月的总天数
function monthDays(y,m) {
return( (lunarInfo[y-1900] & (0x10000>>m))? 30: 29 );
}
//====================================== 算出农历, 传入日期控件, 返回农历日期控件
// 该控件属性有 .year .month .day .isLeap
function Lunar(objDate) {
var i, leap=0, temp=0;
var offset = (Date.UTC(objDate.getFullYear(),objDate.getMonth(),objDate.getDate()) - Date.UTC(1900,0,31))/86400000;
for(i=1900; i<2050 && offset>0; i++) { temp=lYearDays(i); offset-=temp; }
if(offset<0) { offset+=temp; i--; }
this.year = i;
leap = leapMonth(i); //闰哪个月
this.isLeap = false;
for(i=1; i<13 && offset>0; i++) {
//闰月
if(leap>0 && i==(leap+1) && this.isLeap==false)
{ --i; this.isLeap = true; temp = leapDays(this.year); }
else
{ temp = monthDays(this.year, i); }
//解除闰月
if(this.isLeap==true && i==(leap+1)) this.isLeap = false;
offset -= temp;
}
if(offset==0 && leap>0 && i==leap+1)
if(this.isLeap)
{ this.isLeap = false; }
else
{ this.isLeap = true; --i; }
if(offset<0){ offset += temp; --i; }
this.month = i;
this.day = offset + 1;
}
//==============================返回公历 y年某m+1月的天数
function solarDays(y,m) {
if(m==1)
return(((y%4 == 0) && (y%100 != 0) || (y%400 == 0))? 29: 28);
else
return(solarMonth[m]);
}
//============================== 传入 offset 返回干支, 0=甲子
function cyclical(num) {
return(Gan[num%10]+Zhi[num%12]);
}
//============================== 阴历属性
function calElement(sYear,sMonth,sDay,week,lYear,lMonth,lDay,isLeap,cYear,cMonth,cDay) {
this.isToday = false;
//瓣句
this.sYear = sYear; //公元年4位数字
this.sMonth = sMonth; //公元月数字
this.sDay = sDay; //公元日数字
this.week = week; //星期, 1个中文
//农历
this.lYear = lYear; //公元年4位数字
this.lMonth = lMonth; //农历月数字
this.lDay = lDay; //农历日数字
this.isLeap = isLeap; //是否为农历闰月?
//八字
this.cYear = cYear; //年柱, 2个中文
this.cMonth = cMonth; //月柱, 2个中文
this.cDay = cDay; //日柱, 2个中文
this.color = '';
this.lunarFestival = ''; //农历节日
this.solarFestival = ''; //公历节日
this.solarTerms = ''; //节气
}
//===== 某年的第n个节气为几日(从0小寒起算)
function sTerm(y,n) {
var offDate = new Date( ( 31556925974.7*(y-1900) + sTermInfo[n]*60000 ) + Date.UTC(1900,0,6,2,5) );
return(offDate.getUTCDate());
}
//============================== 返回阴历控件 (y年,m+1月)
/*
功能说明: 返回整个月的日期资料控件
使用方式: OBJ = new calendar(年,零起算月);
OBJ.length 返回当月最大日
OBJ.firstWeek 返回当月一日星期
由 OBJ[日期].属性名称 即可取得各项值
OBJ[日期].isToday 返回是否为今日 true 或 false
其他 OBJ[日期] 属性参见 calElement() 中的注解
*/
function calendar(y,m) {
var sDObj, lDObj, lY, lM, lD=1, lL, lX=0, tmp1, tmp2, tmp3;
var cY, cM, cD; //年柱,月柱,日柱
var lDPOS = new Array(3);
var n = 0;
var firstLM = 0;
sDObj = new Date(y,m,1,0,0,0,0); //当月一日日期
this.length = solarDays(y,m); //公历当月天数
this.firstWeek = sDObj.getDay(); //公历当月1日星期几
////////年柱 1900年立春后为庚子年(60进制36)
if(m<2) cY=cyclical(y-1900+36-1);
else cY=cyclical(y-1900+36);
var term2=sTerm(y,2); //立春日期
////////月柱 1900年1月小寒以前为 丙子月(60进制12)
var firstNode = sTerm(y,m*2) //返回当月「节」为几日开始
cM = cyclical((y-1900)*12+m+12);
//当月一日与 1900/1/1 相差天数
//1900/1/1与 1970/1/1 相差25567日, 1900/1/1 日柱为甲戌日(60进制10)
var dayCyclical = Date.UTC(y,m,1,0,0,0,0)/86400000+25567+10;
for(var i=0;i<this.length;i++) {
if(lD>lX) {
sDObj = new Date(y,m,i+1); //当月一日日期
lDObj = new Lunar(sDObj); //农历
lY = lDObj.year; //农历年
lM = lDObj.month; //农历月
lD = lDObj.day; //农历日
lL = lDObj.isLeap; //农历是否闰月
lX = lL? leapDays(lY): monthDays(lY,lM); //农历当月最后一天
if(n==0) firstLM = lM;
lDPOS[n++] = i-lD+1;
}
//依节气调整二月分的年柱, 以立春为界
if(m==1 && (i+1)==term2) cY=cyclical(y-1900+36);
//依节气月柱, 以「节」为界
if((i+1)==firstNode) cM = cyclical((y-1900)*12+m+13);
//日柱
cD = cyclical(dayCyclical+i);
//sYear,sMonth,sDay,week,
//lYear,lMonth,lDay,isLeap,
//cYear,cMonth,cDay
this[i] = new calElement(y, m+1, i+1, nStr1[(i+this.firstWeek)%7],
lY, lM, lD++, lL,
cY ,cM, cD );
}
//节气
tmp1=sTerm(y,m*2 )-1;
tmp2=sTerm(y,m*2+1)-1;
this[tmp1].solarTerms = solarTerm[m*2];
this[tmp2].solarTerms = solarTerm[m*2+1];
if(m==3) this[tmp1].color = 'red'; //清明颜色
//公历节日
for(i in sFtv)
if(sFtv[i].match(/^(\d{2})(\d{2})([\s\*])(.+)$/))
if(Number(RegExp.$1)==(m+1)) {
this[Number(RegExp.$2)-1].solarFestival += RegExp.$4 + ' ';
if(RegExp.$3=='*') this[Number(RegExp.$2)-1].color = 'red';
}
//月周节日
for(i in wFtv)
if(wFtv[i].match(/^(\d{2})(\d)(\d)([\s\*])(.+)$/))
if(Number(RegExp.$1)==(m+1)) {
tmp1=Number(RegExp.$2);
tmp2=Number(RegExp.$3);
if(tmp1<5)
this[((this.firstWeek>tmp2)?7:0) + 7*(tmp1-1) + tmp2 - this.firstWeek].solarFestival += RegExp.$5 + ' ';
else {
tmp1 -= 5;
tmp3 = (this.firstWeek+this.length-1)%7; //当月最后一天星期?
this[this.length - tmp3 - 7*tmp1 + tmp2 - (tmp2>tmp3?7:0) - 1 ].solarFestival += RegExp.$5 + ' ';
}
}
//农历节日
for(i in lFtv)
if(lFtv[i].match(/^(\d{2})(.{2})([\s\*])(.+)$/)) {
tmp1=Number(RegExp.$1)-firstLM;
if(tmp1==-11) tmp1=1;
if(tmp1 >=0 && tmp1<n) {
tmp2 = lDPOS[tmp1] + Number(RegExp.$2) -1;
if( tmp2 >= 0 && tmp2<this.length && this[tmp2].isLeap!=true) {
this[tmp2].lunarFestival += RegExp.$4 + ' ';
if(RegExp.$3=='*') this[tmp2].color = 'red';
}
}
}
//复活节只出现在3或4月
if(m==2 || m==3) {
var estDay = new easter(y);
if(m == estDay.m)
this[estDay.d-1].solarFestival = this[estDay.d-1].solarFestival+' 复活节 Easter Sunday';
}
if(m==2) this[20].solarFestival = this[20].solarFestival+unescape('%20%u6D35%u8CE2%u751F%u65E5');
//黑色星期五
if((this.firstWeek+12)%7==5)
this[12].solarFestival += '黑色星期五';
//今日
if(y==tY && m==tM) this[tD-1].isToday = true;
}
//======================================= 返回该年的复活节(春分后第一次满月周后的第一主日)
function easter(y) {
var term2=sTerm(y,5); //取得春分日期
var dayTerm2 = new Date(Date.UTC(y,2,term2,0,0,0,0)); //取得春分的公历日期控件(春分一定出现在3月)
var lDayTerm2 = new Lunar(dayTerm2); //取得取得春分农历
if(lDayTerm2.day<15) //取得下个月圆的相差天数
var lMlen= 15-lDayTerm2.day;
else
var lMlen= (lDayTerm2.isLeap? leapDays(y): monthDays(y,lDayTerm2.month)) - lDayTerm2.day + 15;
//一天等于 1000*60*60*24 = 86400000 毫秒
var l15 = new Date(dayTerm2.getTime() + 86400000*lMlen ); //求出第一次月圆为公历几日
var dayEaster = new Date(l15.getTime() + 86400000*( 7-l15.getUTCDay() ) ); //求出下个周日
this.m = dayEaster.getUTCMonth();
this.d = dayEaster.getUTCDate();
}
//====================== 中文日期
function cDay(d){
var s;
switch (d) {
case 10:
s = '初十'; break;
case 20:
s = '二十'; break;
break;
case 30:
s = '三十'; break;
break;
default :
s = nStr2[Math.floor(d/10)];
s += nStr1[d%10];
}
return(s);
}
///////////////////////////////////////////////////////////////////////////////
var cld;
function drawCld(SY,SM) {
var i,sD,s,size;
cld = new calendar(SY,SM);
if(SY>1874 && SY<1909) yDisplay = '光绪' + (((SY-1874)==1)?'元':SY-1874);
if(SY>1908 && SY<1912) yDisplay = '宣统' + (((SY-1908)==1)?'元':SY-1908);
if(SY>1911) yDisplay = '建国' + (((SY-1949)==1)?'元':SY-1949);
GZ.innerHTML = yDisplay +'年 农历 ' + cyclical(SY-1900+36) + '年 【'+Animals[(SY-4)%12]+'年】';
YMBG.innerHTML = " " + SY + "<BR> " + monthName[SM];
for(i=0;i<42;i++) {
sObj=eval('SD'+ i);
lObj=eval('LD'+ i);
wObj=eval('WT'+ i);
gdObj=eval('GD'+ i);
gdObj.style.backgroundColor=""
sObj.className = 'SD';
sD = i - cld.firstWeek;
if(sD>-1 && sD<cld.length) { //日期内
sObj.innerHTML = sD+1;
var s_m = SM+1,s_d =sD+1, h_t = (s_m < 10? ('0' + s_m): s_m)+''+ (s_d < 10 ? ('0' + s_d) : s_d);
var workT;
var work_T = worktime["y"+SY];
if(work_T!=undefined){
workT = work_T["d"+h_t];
if(workT!=undefined){
var classN = "";
if(workT.w=="上班"){
classN = "workN";
gdObj.style.backgroundColor="#ffcccc"
}
else{
classN = "rest";
gdObj.style.backgroundColor="#99ffcc"
}
wObj.innerHTML="<div class=\""+classN+"\">" + workT.w + "</div>";
}
else{
wObj.innerHTML="<br>";
}
}
else{
wObj.innerHTML="<br>";
}
if(cld[sD].isToday) sObj.className = 'SD todyaColor'; //今日颜色
sObj.style.color = cld[sD].color; //法定假日颜色
if(cld[sD].lDay==1) //显示农历月
lObj.innerHTML = '<b>'+(cld[sD].isLeap?'闰':'') + cld[sD].lMonth + '月' + (monthDays(cld[sD].lYear,cld[sD].lMonth)==29?'小':'大')+'</b>';
else //显示农历日
lObj.innerHTML = cDay(cld[sD].lDay);
s=cld[sD].lunarFestival;
if(s.length>0) { //农历节日
if(s.length>6) s = s.substr(0, 4)+'..';
s = s.fontcolor('red');
}
else { //公历节日
s=cld[sD].solarFestival;
if(s.length>0) {
size = (s.charCodeAt(0)>0 && s.charCodeAt(0)<128)?8:4;
if(s.length>size+2) s = s.substr(0, size)+'..';
s=(s=='黑色星期五')?s.fontcolor('black'):s.fontcolor('blue');
}
else { //廿四节气
s=cld[sD].solarTerms;
if(s.length>0) s = s.fontcolor('limegreen');
}
}
if(cld[sD].solarTerms=='清明') s = '清明节'.fontcolor('red');
if(cld[sD].solarTerms=='芒种') s = '芒种节'.fontcolor('red');
if(cld[sD].solarTerms=='夏至') s = '夏至节'.fontcolor('red');
if(cld[sD].solarTerms=='冬至') s = '冬至节'.fontcolor('red');
if(s.length>0) lObj.innerHTML = s;
}
else { //非日期
sObj.innerHTML = '';
lObj.innerHTML = '';
wObj.innerHTML = '';
}
}
}
function changeCld() {
var y,m;
y=CLD.SY.selectedIndex+1900;
m=CLD.SM.selectedIndex;
drawCld(y,m);
}
function pushBtm(K) {
switch (K){
case 'YU' :
if(CLD.SY.selectedIndex>0) CLD.SY.selectedIndex--;
break;
case 'YD' :
if(CLD.SY.selectedIndex<150) CLD.SY.selectedIndex++;
break;
case 'MU' :
if(CLD.SM.selectedIndex>0) {
CLD.SM.selectedIndex--;
}
else {
CLD.SM.selectedIndex=11;
if(CLD.SY.selectedIndex>0) CLD.SY.selectedIndex--;
}
break;
case 'MD' :
if(CLD.SM.selectedIndex<11) {
CLD.SM.selectedIndex++;
}
else {
CLD.SM.selectedIndex=0;
if(CLD.SY.selectedIndex<150) CLD.SY.selectedIndex++;
}
break;
default :
CLD.SY.selectedIndex=tY-1900;
CLD.SM.selectedIndex=tM;
}
changeCld();
}
var Today = new Date();
var tY = Today.getFullYear();
var tM = Today.getMonth();
var tD = Today.getDate();
//////////////////////////////////////////////////////////////////////////////
var width = "130";
var offsetx = 2;
var offsety = 8;
var x = 0;
var y = 0;
var snow = 0;
var sw = 0;
var cnt = 0;
var dStyle;
document.onmousemove = mEvn;
//显示详细日期资料
function mOvr(v) {
var s,festival;
var sObj=eval('SD'+ v);
var d=sObj.innerHTML-1;
//sYear,sMonth,sDay,week,
//lYear,lMonth,lDay,isLeap,
//cYear,cMonth,cDay
if(sObj.innerHTML!='') {
sObj.style.cursor = 's-resize';
if(cld[d].solarTerms == '' && cld[d].solarFestival == '' && cld[d].lunarFestival == '')
festival = '';
else
festival = '<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR="#CCFFCC"><TR><TD>'+
'<FONT COLOR="#000000" STYLE="font-size:9pt;">'+cld[d].solarTerms + ' ' + cld[d].solarFestival + ' ' + cld[d].lunarFestival+'</FONT></TD>'+
'</TR></TABLE>';
s= '<TABLE WIDTH="130" BORDER=0 CELLPADDING="2" CELLSPACING=0 BGCOLOR="#000066" style="filter:Alpha(opacity=80)"><TR><TD>' +
'<TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD ALIGN="right"><FONT COLOR="#ffffff" STYLE="font-size:9pt;">'+
cld[d].sYear+' 年 '+cld[d].sMonth+' 月 '+cld[d].sDay+' 日<br>星期'+cld[d].week+'<br>'+
'<font color="violet">农历'+(cld[d].isLeap?'闰 ':' ')+cld[d].lMonth+' 月 '+cld[d].lDay+' 日</font><br>'+
'<font color="yellow">'+cld[d].cYear+'年 '+cld[d].cMonth+'月 '+cld[d].cDay + '日</font>'+
'</FONT></TD></TR></TABLE>'+ festival +'</TD></TR></TABLE>';
document.all["detail"].innerHTML = s;
if (snow == 0) {
dStyle.left = x+offsetx-(width/2)+"px";
dStyle.top = y+offsety+"px";
dStyle.visibility = "visible";
snow = 1;
}
}
}
//清除详细日期资料
function mOut() {
if ( cnt >= 1 ) { sw = 0; }
if ( sw == 0 ) { snow = 0; if(dStyle)dStyle.visibility = "hidden";}
else cnt++;
}
//取得位置
function mEvn(e) {
e= e||window.event;
x=e.clientX;
y=e.clientY;
if (document.body.scrollLeft)
{x=event.x+document.body.scrollLeft; y=event.y+document.body.scrollTop;}
if (snow){
dStyle.left = x+offsetx-(width/2);
dStyle.top = y+offsety;
}
}
///////////////////////////////////////////////////////////////////////////
function changeTZ() {
CITY.innerHTML = CLD.TZ.value.substr(6)
setCookie("TZ",CLD.TZ.selectedIndex)
}
function tick() {
var today
today = new Date()
Clock.innerHTML = getCnDayString(today);
Clock2.innerHTML = getEnDayString(TimeAdd(new Date(today.toUTCString().slice(0,-4)), CLD.TZ.value))+(blnSummerTime?"<FONT STYLE='font-size:18pt;font-family:Wingdings; color:red'>R</FONT>":"");
setTimeout("tick()", 1000);
}
function setCookie(name, value) {
var today = new Date()
var expires = new Date()
expires.setTime(today.getTime() + 1000*60*60*24*365)
document.cookie = name + "=" + escape(value) + "; expires=" + expires.toGMTString()
}
function getCookie(Name) {
var search = Name + "="
if(document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if(offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset)
if(end == -1) end = document.cookie.length
return unescape(document.cookie.substring(offset, end))
}
else return ""
}
}
function getCnDayString (dtmDay) {
return dtmDay.getFullYear()+"年"+(dtmDay.getMonth()+1)+"月"+dtmDay.getDate()+"日 "+dtmDay.getHours()+":"+((dtmDay.getMinutes().toString().length==1)?"0":"")+dtmDay.getMinutes()+":"+((dtmDay.getSeconds().toString().length==1)?"0":"")+dtmDay.getSeconds();
}
function getEnDayString (dtmDay) {
return dtmDay.getFullYear()+"-"+(dtmDay.getMonth()+1)+"-"+dtmDay.getDate()+" "+dtmDay.getHours()+":"+((dtmDay.getMinutes().toString().length==1)?"0":"")+dtmDay.getMinutes()+":"+((dtmDay.getSeconds().toString().length==1)?"0":"")+dtmDay.getSeconds();
}
function TimeAdd (UTC,T) {
var PlusMinus, y;
if (T.charAt(0)=="-") {
PlusMinus = -1;
}
else {
PlusMinus = 1
}
//alert(UTC)
//UTC=UTC.slice(4,UTC.length-4);
//alert(UTC)
y=UTC.getFullYear();
UTC.setMinutes(UTC.getMinutes()-(-T.slice(1,3)*60-T.slice(3,5))*PlusMinus);
//alert(UTC)
//美国国会于2005年通过扩大日光节约时间法案,将原来开始时间从4月的第一个星期日,提早到3月的第二个星期日;结束时间则从10月的最后一个星期日,延长到11月的第一个星期日。
var dtmDaylightSavingBegin,dtmDaylightSavingEnd;
dtmDaylightSavingBegin = new Date(y,3,0);
dtmDaylightSavingBegin.setDate(dtmDaylightSavingBegin.getDate()+(7-dtmDaylightSavingBegin.getDay())%7+7);
dtmDaylightSavingEnd = new Date(y,10,0);
dtmDaylightSavingEnd.setDate(dtmDaylightSavingEnd.getDate()+(7-dtmDaylightSavingEnd.getDay())%7);
if (T.slice(5,6)=="*" && UTC>=dtmDaylightSavingBegin && UTC<=dtmDaylightSavingEnd) {
UTC.setHours(UTC.getHours()+1);
blnSummerTime = true;
}
return UTC;
}
/////////////////////////////////////////////////////////
function initial() {
if (navigator.userAgent.indexOf('MSIE')<0) {
document.getElementById("worldmap").innerHTML="";
}
dStyle = detail.style;
CLD.SY.selectedIndex=tY-1900;
CLD.SM.selectedIndex=tM;
drawCld(tY,tM);
pushBtm('');
CLD.TZ.selectedIndex=getCookie("TZ");
changeTZ();
tick();
}
//-->
</script>
<style>
.todyaColor {
BACKGROUND-COLOR: aqua
}
</style>
<meta content="MSHTML 6.00.2800.1505" name="GENERATOR">
</head>
<body leftmargin="0" topmargin="0">
<script language="JavaScript">
lck=0;
function r(hval)
{
if ( lck == 0 )
{
document.bgColor=hval;
}
}
</script>
<div id="detail" style="POSITION: absolute">
</div>
<center>
<form name="CLD" onsubmit="return false">
<table>
<tbody>
<tr>
<td valign="top" align="middle">
<br>
<font style="FONT-SIZE: 9pt" size="2">本机时间:</font><br>
<font id="Clock" face="Arial" color="#000080" size="4" align="center"></font>
<p>
<!--时区 *表示自动调整为日光节约时间--><font style="FONT-SIZE: 9pt" size="2">
<select style="FONT-SIZE: 9pt" onchange="changeTZ()" name="TZ">
<option value="-1200 安尼威土克、瓜甲兰" selected>国际换日线
<option value="-1100 中途岛、萨摩亚群岛">萨摩亚
<option value="-1000 夏威夷">夏威夷
<option value="-0900*阿拉斯加">阿拉斯加
<option value="-0800*太平洋时间(美加)、提亚纳">太平洋
<option value="-0700*亚历桑那">美国山区
<option value="-0700*山区时间(美加)">美加山区
<option value="-0600*萨克其万(加拿大)">加拿大中部
<option value="-0600*墨西哥市、塔克西卡帕">墨西哥
<option value="-0600*中部时间(美加)">美加中部
<option value="-0500*波哥大、里玛">南美洲太平洋
<option value="-0500*东部时间(美加)">美加东部
<option value="-0500*印第安纳(东部)">美东
<option value="-0400*加拉卡斯、拉帕兹">南美洲西部
<option value="-0400*大西洋时间 加拿大)">大西洋
<option value="-0330 新岛(加拿大东岸)">纽芬兰
<option value="-0300 波西尼亚">东南美洲
<option value="-0300 布鲁诺斯爱丽斯、乔治城">南美洲东部
<option value="-0200*大西洋中部">大西洋中部
<option value="-0100*亚速尔群岛、维德角群岛">亚速尔
<option value="+0000 格林威治时间、都柏林、爱丁堡、伦敦">英国夏令
<option value="+0000 莫洛维亚(赖比瑞亚)、卡萨布兰卡">格林威治标准
<option value="+0100 巴黎、马德里">罗马
<option value="+0100 布拉格, 华沙, 布达佩斯">中欧
<option value="+0100 柏林、斯德哥尔摩、罗马、伯恩、布鲁赛尔、维也纳">西欧
<option value="+0200 以色列">以色列
<option value="+0200*东欧">东欧
<option value="+0200*开罗">埃及
<option value="+0200*雅典、赫尔辛基、伊斯坦堡">GFT
<option value="+0200*赫拉雷、皮托里">南非
<option value="+0300*巴格达、科威特、奈洛比(肯亚)、里雅德(沙乌地)">沙乌地阿拉伯
<option value="+0300*莫斯科、圣彼得堡、贺占、窝瓦格瑞德">俄罗斯
<option value="+0330*德黑兰">伊朗
<option value="+0400*阿布达比(东阿拉伯)、莫斯凯、塔布理斯(乔治亚共和)">阿拉伯
<option value="+0430*喀布尔">阿富汗
<option value="+0500 伊斯兰马巴德、克洛奇、伊卡特林堡、塔须肯">西亚
<option value="+0530 孟买、加尔各答、马垂斯、新德里、可伦坡">印度
<option value="+0600 阿马提、达卡">中亚
<option value="+0700 曼谷、亚加达、胡志明市">曼谷
<option value="+0800 北京、重庆、黑龙江">中国
<option value="+0800 台湾、香港、新加坡">台北
<option value="+0900 东京、大阪、扎幌、汉城、亚库兹(东西伯利亚)">东京
<option value="+0930 达尔文">澳洲中部
<option value="+1000 布里斯本、墨尔本、席德尼">席德尼
<option value="+1000 霍巴特">塔斯梅尼亚
<option value="+1000 关岛、莫斯比港、海 威">西太平洋
<option value="+1100*马哥大、所罗门群岛、新卡伦多尼亚">太平洋中部
<option value="+1200 威灵顿、奥克兰">纽西兰
<option value="+1200 斐济、肯加塔、马歇尔群岛">斐济</option>
</select>
时间 </font><br>
<font id="Clock2" face="Arial" color="#000080" size="4" align="center"></font><br>
<font style="FONT-SIZE: 120pt; COLOR: green; FONT-FAMILY:Webdings" id="worldmap">û</font><br>
<font id="CITY" style="FONT-SIZE: 9pt; WIDTH: 150px; COLOR: blue; FONT-FAMILY: '新细明体'"></font>
</p>
</td>
<td align="middle">
<div style="Z-INDEX: -1; POSITION: absolute; TOP: 30px">
<font id="YMBG" style="FONT-SIZE: 90pt; COLOR: #f0f0f0; FONT-FAMILY: 'Arial Black'"> 0000<br>
JUN</font>
</div>
<table border="0">
<tbody>
<tr>
<td bgcolor="#000080" colspan="7">
<font style="FONT-SIZE: 9pt" color="#ffffff" size="2">公历
<select style="FONT-SIZE: 9pt" onchange="changeCld()" name="SY">
<script language="JavaScript"><!--
for(i=1900;i<2050;i++) document.write('<option>'+i)
//--></script>
</select>
年
<select style="FONT-SIZE: 9pt" onchange="changeCld()" name="SM">
<script language="JavaScript"><!--
for(i=1;i<13;i++) document.write('<option>'+i)
//--></script>
</select>
月 </font><font id="GZ" face="标楷体" color="yellow" size="3"></font><br>
</td>
</tr>
<tr align="middle" bgcolor="#e0e0e0">
<td width="60">
<font color="red">日</font>
</td>
<td width="60">
一
</td>
<td width="60">
二
</td>
<td width="60">
三
</td>
<td width="60">
四
</td>
<td width="60">
五
</td>
<td width="60">
<font color="green">六</font>
</td>
</tr>
<script language="JavaScript"><!--
var gNum
for(i=0;i<6;i++) {
document.write('<tr align="center">')
for(j=0;j<7;j++) {
gNum = i*7+j
document.write('<td id="GD' + gNum +'" onMouseOver="mOvr(' + gNum +')" onMouseOut="mOut()"><font id="WT' + gNum + '" class="WT"></font><font id="SD' + gNum +'" class="SD"')
if(j == 0) document.write(' color=red')
if(j == 6)
if(i%2==1) document.write(' color=red')
else document.write(' color=green')
document.write(' TITLE=""> </font><br><font id="LD' + gNum + '" size=2 style="font-size:9pt"> </font></td>')
}
document.write('</tr>')
}
//--></script>
</tbody>
</table>
</td>
<td valign="top" align="middle" width="40">
<br>
<br>
<br>
<br>
<button style="FONT-SIZE: 9pt" onclick="pushBtm('YU')">年↑</button><br>
<button style="FONT-SIZE: 9pt" onclick="pushBtm('YD')">年↓</button>
<p>
<button style="FONT-SIZE: 9pt" onclick="pushBtm('MU')">月↑</button><br>
<button style="FONT-SIZE: 9pt" onclick="pushBtm('MD')">月↓</button>
<p>
<button style="FONT-SIZE: 9pt" onclick="pushBtm('')">今日</button>
</p>
</td>
</tr>
</tbody>
</table>
</form>
<p>
</p>
<hr width="90%" color="#cccccc" noshade size="1">
<font style="FONT-SIZE: 9pt" face="ARIAL" size="2">阳历中<font color="red">红色</font>/<font color="green">绿色</font><font color="black">表示节假日,农历中<font color="green">绿色</font>表示为24节气日,<font color="red">红色</font>表示为传统节日,<font color="blue">蓝色</font>则表示为公众节假日<br>
<script type="text/javascript">
<!--
initial()
//-->
</script>
</center>
<br>
<table align="center" border="0" cellpadding="3" cellspacing="0" width="700">
<tr>
<td align="center">
<b><font color="#008000"></font></b>
</td>
</tr>
</table>
</body>
</html>
把以上代码保存为html文件
万年历(hao123)代码的更多相关文章
- javascript时钟代码 DEMO-002
转载自:http://www.cnblogs.com/Mygirl/archive/2012/03/30/2425832.html 正常时间显示 复制代码 <SCRIPT language=ja ...
- js中的经典案例--简易万年历
js中的经典案例--简易万年历 html代码 <!DOCTYPE html> <html> <head> <meta charset="utf-8& ...
- 0302借软件工程触IT
没有不想学好的学生,也没有选择计算机软件专业后不想过能进军IT的行业的.就对于自己情况来说,大学选择计算机商业软件专业学习也有一年多时间了,未接触专业知识前IT是一个高大上的向往,在初学C语 ...
- Selenium系列4-元素定位
前言 说起元素定位,一定是学习自动化测试绕不开的第一道关,无论是web端的UI自动化还是移动端的自动化,在需要首先对元素进行定位才可以完成对元素的操作已达成测试目的,在Selenium中,可以使用fi ...
- IT第六天 - eclipse快捷操作、万年历项目的编写、菱形的打印输出、代码简化
IT第六天 上午 小项目 1.程序提前结束的退出标志 2.登录用户的模拟,给出适当的提示信息 3.根据要求,寻找规律,然后编写程序 Eclipse的使用 1.快捷键的使用 下午 中小项目 1.九九乘法 ...
- 编程代码 | C++/C输出阳历万年历—精美日历制作
前言:本文章向大家介绍如何用C语言代码实现万年历使用实例.应用技巧.基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下. void输出万年历(int年, int月, int日 ...
- 算法,java代码实现打印万年历
万年历 以1900年1月1号星期一为时间原点 星期日 第一天 星期一 第二天 星期二 第三天 星期三 第四天 星期四 第五天 星期五 第六天 星期六 第七天 1.计算出当前日 ...
- 带节假日JS万年历控件代码
<form name="CLD" class="content"> <table width="100%" border= ...
- php万年历
最近学习php循环.日期显示.GET方式请求,进而实现了一个小程序. 直接上代码: <?php header("Content-type:text/html; charset=UTF- ...
随机推荐
- warning: LF will be replaced by CRLF in ***. The file will have its original line endings in your working directory.
git config --global core.autocrlf false
- python-day6---while循环
# while 条件:# 循环体的代码1# 循环体的代码2# 循环体的代码3# count=0# while count < 10:# print(count)# count+=1 # whil ...
- es-hadoop saveToEsWithMeta
@Test def testEsRDDWriteWithDynamicMapping() { val doc1 = Map("one" -> null, "two& ...
- winform窗体this方式和handle(句柄)方式的区别
我们来比较winform窗体的this方式和win32api handle方式实现窗体的最大化.默认窗体.半透明.不透明的区别 1.窗体界面设计 this方式按钮: btnMaxWindow. btn ...
- js上传图片前预览方法(支持预览多个图片)
运用js实现上传图片前的预览(支持多张图片),实现的例子如下: 1.源码例子: 1)Js脚本页面 <!doctype html> <html> <head> < ...
- Our supersheet
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...
- W1002 Symbol 'Create' is specific to a platform
http://stackoverflow.com/questions/9099892/how-to-use-tformatsettings-create-without-being-specific- ...
- Pycharm(二)创建项目
首次打开就是这样,可以创建新项目,打开一个项目,也可以从版本控制打开项目 我们就新建项目吧,Create New Project 创建项目就是这样了 Location:项目路径. Interprete ...
- Dash:程序员的好帮手(转载)
作为一名死coder,每天最常见的动作就是查看各种API文档,你一定也有过同时打开N个窗口(HTML.PDF.CHM),不停的在编辑器与文档之间切换的感受吧?怎么说呢,其实我很讨厌这种枯燥无味的动作, ...
- CreateFile DeviceIoControl dwIoControlCode——应用程序与驱动程序通信
在“进程内存管理器中”的一个Ring0,Ring3层通信问题,之前也见过这样的代码,这次拆分出来详细总结一下. 先通过CreateFile函数得到设备句柄,CreateFile函数原型: HANDLE ...