js实现带农历和八字等信息的日历特效.docx

上传人:b****5 文档编号:11796594 上传时间:2023-04-02 格式:DOCX 页数:13 大小:20.54KB
下载 相关 举报
js实现带农历和八字等信息的日历特效.docx_第1页
第1页 / 共13页
js实现带农历和八字等信息的日历特效.docx_第2页
第2页 / 共13页
js实现带农历和八字等信息的日历特效.docx_第3页
第3页 / 共13页
js实现带农历和八字等信息的日历特效.docx_第4页
第4页 / 共13页
js实现带农历和八字等信息的日历特效.docx_第5页
第5页 / 共13页
点击查看更多>>
下载资源
资源描述

js实现带农历和八字等信息的日历特效.docx

《js实现带农历和八字等信息的日历特效.docx》由会员分享,可在线阅读,更多相关《js实现带农历和八字等信息的日历特效.docx(13页珍藏版)》请在冰豆网上搜索。

js实现带农历和八字等信息的日历特效.docx

js实现带农历和八字等信息的日历特效

js实现带农历和八字等信息的日历特效_

本文主要介绍了js实现带农历和八字等信息的日历特效,我觉得挺不错的,现在分享给大家,也给大家做个参考

自己也尝试着做了一下,收获蛮大,把握了js日历特效的实现原理后,再想增加更多的功能,完全就可以自由发挥了,先在这里分享一下吧,有爱好的可以试试!

本文实例为大家分享了js实现带农历等信息的日历特效,代码量很大,供大家参考,具体内容如下

效果图:

实现代码:

代码如下:

HTML

HEAD

TITLE万年历/TITLE

METAcontent="农历;阳历;月历;节日;时区;节气;八字;干支;生肖;gregoriansolar;chineselunar;calendar;"name=keywords

METAcontent=Allname=robots

METAcontent="gregoriansolarcalendarandchineselunarcalendar"name=description

metacharset="UTF-8"/

styletype="text/css"

body{

margin:

0px;

padding:

0px;

}

/style

/head

body

centerbr

tablecellpadding="0"cellspacing="0"id="1"

tr

td

style

#cal{

width:

434px;

border:

1pxsolid#c3d9ff;

font-size:

12px;

margin:

8px0015px;

}

#cal#top{

height:

29px;

line-height:

29px;

background:

#e7eef8;

color:

#003784;

padding-left:

30px;

}

#cal#topselect{

font-size:

12px;

}

#cal#topinput{

padding:

0;

}

#calul#wk{

margin:

0;

padding:

0;

height:

25px;

}

#calul#wkli{

float:

left;

width:

60px;

text-align:

center;

line-height:

25px;

list-style:

none;

}

#calul#wklib{

font-weight:

normal;

color:

#c60b02;

}

#cal#cm{

clear:

left;

border-top:

1pxsolid#ddd;

border-bottom:

1pxdotted#ddd;

position:

relative;

}

#cal#cm.cell{

position:

absolute;

width:

42px;

height:

36px;

text-align:

center;

margin:

0009px;

}

#cal#cm.cell.so{

font:

bold16pxarial;

}

#cal#bm{

text-align:

right;

height:

24px;

line-height:

24px;

padding:

013px00;

}

#cal#bma{

color:

7977ce;

}

#cal#fd{

display:

none;

position:

absolute;

border:

1pxsolid#dddddf;

background:

#feffcd;

padding:

10px;

line-height:

21px;

width:

150px;

}

#cal#fdb{

font-weight:

normal;

color:

#c60a00;

}

/style

!

--[ifIE]

style#cal#top{padding-top:

4px;}#cal#topinput{width:

65px;}#cal#fd{width:

170px;}/style

!

[endif]--

divid="cal"

divid="top"公元select/select年select/select月农历span/span年[span/span年]inputtype="button"value="回到今日"title="点击后跳转回今日"style="padding:

0px"/div

ulid="wk"

li一/li

li二/li

li三/li

li四/li

li五/li

lib六/b/li

lib日/b/li

/ul

divid="cm"/div

divid="bm"atarget="_blank"onmousedown="returnc({'fm':

'alop','title':

this.innerHTML,'url':

this.href,'p1':

al_c(this),'p2':

1})"href="javascript:

void(0)"历史上的今日/a/div

/div

/td

/tr

/table

/center

/body

scriptlanguage="JavaScript"!

--

(function(){

varS=navigator.userAgent.indexOf("MSIE")!

=-1!

window.opera;

functionM(C){

returndocument.getElementById(C)

}

functionR(C){

returndocument.createElement(C)

}

varP=[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];

varK="甲乙丙丁戊己庚辛壬癸";

varJ="子丑寅卯辰巳午未申酉戌亥";

varO="鼠牛虎兔龙蛇马羊猴鸡狗猪";

varL=["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"];

varD=[0,21208,43467,63836,85337,107014,128867,150921,173149,195551,218072,240693,263343,285989,308563,331033,353350,375494,397447,419210,440795,462224,483532,504758];

varB="日一二三四五六七八九十";

varH=["正","二","三","四","五","六","七","八","九","十","十一","腊"];

varE="初十廿卅";

varV={

"0101":

"*1元旦节",

"0214":

"情人节",

"0305":

"学雷锋纪念日",

"0308":

"妇女节",

"0312":

"植树节",

"0315":

"消费者权益日",

"0401":

"愚人节",

"0501":

"*1劳动节",

"0504":

"青年节",

"0601":

"国际儿童节",

"0701":

"中国共产党诞辰",

"0801":

"建军节",

"0910":

"中国老师节",

"1001":

"*3国庆节",

"1224":

"平安夜",

"1225":

"圣诞节"

};

varT={

"0101":

"*2春节",

"0115":

"元宵节",

"0505":

"*1端午节",

"0815":

"*1中秋节",

"0909":

"重阳节",

"1208":

"腊八节",

"0100":

"除夕"

};

functionU(Y){

functionc(j,i){

varh=newDate((31556925974.7*(j-1900)+D[i]*60000)+Date.UTC(1900,0,6,2,5));

return(h.getUTCDate())

}

functiond(k){

varh,j=348;

for(h=32768;h8;h=1){

j+=(P[k-1900]h)?

1:

0

}

return(j+b(k))

}

functiona(h){

return(K.charAt(h%10)+J.charAt(h%12))

}

functionb(h){

if(g(h)){

return((P[h-1900]65536)?

30:

29)

}else{

return(0)

}

}

functiong(h){

return(P[h-1900]15)

}

functione(i,h){

return((P[i-1900](65536h))?

30:

29)

}

functionC(m){

vark,j=0,

h=0;

varl=newDate(1900,0,31);

varn=(m-l)/86400000;

this.dayCyl=n+40;

this.monCyl=14;

for(k=1900;k2050n0;k++){

h=d(k);

n-=h;

this.monCyl+=12

}

if(n0){

n+=h;

k--;

this.monCyl-=12

}

this.year=k;

this.yearCyl=k-1864;

j=g(k);

this.isLeap=false;

for(k=1;k13n0;k++){

if(j0k==(j+1)this.isLeap==false){

--k;

this.isLeap=true;

h=b(this.year)

}else{

h=e(this.year,k)

}

if(this.isLeap==truek==(j+1)){

this.isLeap=false

}

n-=h;

if(this.isLeap==false){

this.monCyl++

}

}

if(n==0j0k==j+1){

if(this.isLeap){

this.isLeap=false

}else{

this.isLeap=true;

--k;

--this.monCyl

}

}

if(n0){

n+=h;

--k;

--this.monCyl

}

this.month=k;

this.day=n+1

}

functionG(h){

returnh10?

"0"+h:

h

}

functionf(i,j){

varh=i;

returnj.replace(/dd?

d?

d?

|MM?

M?

M?

|yy?

y?

y?

/g,function(k){

switch(k){

case"yyyy":

varl="000"+h.getFullYear();

returnl.substring(l.length-4);

case"dd":

returnG(h.getDate());

case"d":

returnh.getDate().toString();

case"MM":

returnG((h.getMonth()+1));

case"M":

returnh.getMonth()+1

}

})

}

functionZ(i,h){

varj;

switch(i,h){

case10:

j="初十";

break;

case20:

j="二十";

break;

case30:

j="三十";

break;

default:

j=E.charAt(Math.floor(h/10));

j+=B.charAt(h%10)

}

return(j)

}

this.date=Y;

this.isToday=false;

this.isRestDay=false;

this.solarYear=f(Y,"yyyy");

this.solarMonth=f(Y,"M");

this.solarDate=f(Y,"d");

this.solarWeekDay=Y.getDay();

this.solarWeekDayInChinese="星期"+B.charAt(this.solarWeekDay);

varX=newC(Y);

this.lunarYear=X.year;

this.shengxiao=O.charAt((this.lunarYear-4)%12);

this.lunarMonth=X.month;

this.lunarIsLeapMonth=X.isLeap;

this.lunarMonthInChinese=this.lunarIsLeapMonth?

"闰"+H[X.month-1]:

H[X.month-1];

this.lunarDate=X.day;

this.showInLunar=this.lunarDateInChinese=Z(this.lunarMonth,this.lunarDate);

if(this.lunarDate==1){

this.showInLunar=this.lunarMonthInChinese+"月"

}

this.ganzhiYear=a(X.yearCyl);

this.ganzhiMonth=a(X.monCyl);

this.ganzhiDate=a(X.dayCyl++);

this.jieqi="";

this.restDays=0;

if(c(this.solarYear,(this.solarMonth-1)*2)==f(Y,"d")){

this.showInLunar=this.jieqi=L[(this.solarMonth-1)*2]

}

if(c(this.solarYear,(this.solarMonth-1)*2+1)==f(Y,"d")){

this.showInLunar=this.jieqi=L[(this.solarMonth-1)*2+1]

}

if(this.showInLunar=="清明"){

this.showInLunar="清明节";

this.restDays=1

}

this.solarFestival=V[f(Y,"MM")+f(Y,"dd")];

if(typeofthis.solarFestival=="undefined"){

this.solarFestival=""

}else{

if(/\*(\d)/.test(this.solarFestival)){

this.restDays=parseInt(RegExp.$1);

this.solarFestival=this.solarFestival.replace(/\*\d/,"")

}

}

this.showInLunar=(this.solarFestival=="")?

this.showInLunar:

this.solarFestival;

this.lunarFestival=T[this.lunarIsLeapMonth?

"00":

G(this.lunarMonth)+G(this.lunarDate)];

if(typeofthis.lunarFestival=="undefined"){

this.lunarFestival=""

}else{

if(/\*(\d)/.test(this.lunarFestival)){

this.restDays=(this.restDaysparseInt(RegExp.$1))?

this.restDays:

parseInt(RegExp.$1);

this.lunarFestival=this.lunarFestival.replace(/\*\d/,"")

}

}

if(this.lunarMonth==12this.lunarDate==e(this.lunarYear,12)){

this.lunarFestival=T["0100"];

this.restDays=1

}

this.showInLunar=(this.lunarFestival=="")?

this.showInLunar:

this.lunarFestival;

this.showInLunar=(this.showInLunar.length4)?

this.showInLunar.substr(0,2)+"...":

this.showInLunar

}

varQ=(function(){

varX={};

X.lines=0;

X.dateArray=newArray(42);

functionY(a){

return(((a%

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 医药卫生 > 临床医学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1