축제와 음력이 포함된 스크립트: 코드 복사 코드는 다음과 같습니다. 带农历的日历 <br> <!--<br /> var lunarInfo=새 배열(<br /> 0x04bd8,0x04ae0,0x0a570,0x054d5,0x0d260,0x0d950,0x16554,0x056a0,0x09ad0,0x055d2,<br /> 0x04ae0,0x0a5b6,0x0a4d0,0x0d250,0x1d255,0x0b540,0x0d6a0,0x0ada2,0x095b0,0x14977,<br /> 0x04970,0x0a4b0,0x0b4b5,0x06a50,0x06d40,0x1ab54,0x02b60,0x09570,0x052f2,0x04970,<br /> 0x06566,0x0d4a0,0x0ea50,0x06e95,0x05ad0,0x02b60,0x186e3,0x092e0,0x1c8d7,0x0c950,<br /> 0x0d4a0,0x1d8a6,0x0b550,0x056a0,0x1a5b4,0x025d0,0x092d0,0x0d2b2,0x0a950,0x0b557,<br /> 0x06ca0,0x0b550,0x15355,0x04da0,0x0a5d0,0x14573,0x052d0,0x0a9a8,0x0e950,0x06aa0,<br /> 0x0aea6,0x0ab50,0x04b60,0x0aae4,0x0a570,0x05260,0x0f263,0x0d950,0x05b57,0x056a0,<br /> 0x096d0,0x04dd5,0x04ad0,0x0a4d0,0x0d4d4,0x0d250,0x0d558,0x0b540,0x0b5a0,0x195a6,<br /> 0x095b0,0x049b0,0x0a974,0x0a4b0,0x0b27a,0x06a50,0x06d40,0x0af46,0x0ab60,0x09570,<br /> 0x04af5,0x04970,0x064b0,0x074a3,0x0ea50,0x06b58,0x055c0,0x0ab60,0x096d5,0x092e0,<br /> 0x0c960,0x0d954,0x0d4a0,0x0da50,0x07552,0x056a0,0x0abb7,0x025d0,0x092d0,0x0cab5,<br /> 0x0a950,0x0b4a0,0x0baa4,0x0ad50,0x055d9,0x04ba0,0x0a5b0,0x15176,0x052b0,0x0a930,<br /> 0x07954,0x06aa0,0x0ad50,0x05b52,0x04b60,0x0a6e6,0x0a4e0,0x0d260,0x0ea65,0x0d530,<br /> 0x05aa0,0x076a3,0x096d0,0x04bd7,0x04ad0,0x0a4d0,0x1d0b6,0x0d250,0x0d520,0x0dd45,<br /> 0x0b5a0,0x056d0,0x055b2,0x049b0,0x0a577,0x0a4b0,0x0aa50,0x1b255,0x06d20,0x0ada0)<br /> <br /> var SolarMonth=새 배열(31,28,31,30,31,30,31,31,30,31,30,31);<br /> var Animals=new Array("鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗", "猪");<br /> var SolarTerm = new Array("小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","작은满","芒种", "夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至");<br /> var sTermInfo = 새 배열(0,21208,42467,63836,85337,107014,128867,150921,173149,195551,218072,240693,263343,285989,308563,331033,353350, 375494,397447,419210,440795,462224, 483532,504758);<br /> var nStr1 = new Array('日','一','이','삼','사','五','六','七','八','九','十') ;<br /> var nStr2 = new Array('初','十','廿','卅');<br /> //공공축일<br /> var sFtv = 새 배열(<br /> "0101 원旦",<br /> "0214 情人节",<br /> "0308 妇女节",<br /> "0312 植树节",<br /> "0315 消费者权益日",<br /> "0401 愚人节",<br /> "0501 劳动节",<br /> "0504 青年节",<br /> "0512 护士节",<br /> "0601 儿童节",<br /> "0701 建党节",<br /> "0801 建军节",<br /> "0910 教师节",<br /> "0928 孔子诞辰",<br /> "1001 國庆节",<br /> "1006 老人节",<br /> "1024 联합국제일",<br /> "1224 평안夜",<br /> "1225 圣诞节")<br /> //农历节日<br /> var lFtv = 새 배열(<br /> "0101 春节",<br /> "0115 元宵节",<br /> "0505 端午节",<br /> "0707 七夕情人节",<br /> "0715 중원节",<br /> "0815 中秋节",<br /> "0909 大阳节",<br /> "1208 腊八节",<br /> "1224년")<br /> //返回农历y年总天数<br /> 함수 lYearDays(y) {<br /> var i, sum = 348;<br /> for(i=0x8000; i>0x8; i>>=1)sum =(lunarInfo[y-1900]&i)?1:0;<br /> return(합계 도약일수(y));<br /> }<br /> //返回农历y年闰月적하늘<br /> 함수 도약일(y) {<br /> if(leapMonth(y)) return((lunarInfo[y-1900] & 0x10000)? 30: 29);<br /> 그렇지 않으면 반환(0);<br /> }<br /> //判断y年的农历中那个月是闰月,不是闰月返回0<br /> 함수 도약월(y){<br /> return(lunarInfo[y-1900]&0xf);<br /> }<br /> //返回农历y年m월적总天数<br /> 함수 월일(y,m){<br /> return((lunarInfo[y-1900]&(0x10000>>m))?30:29);<br> }<br> //算当前月第一天的农历日期和当前农历日期下一个月农历的第一天日期<br> 함수 Dianaday(objDate) {<br> var i, 도약=0, 온도=0;<br> var baseDate = new Date(1900,0,31);<br> var 오프셋 = (objDate - baseDate)/86400000;<br> this.dayCyl = 오프셋 40;<br> this.monCyl = 14;<br> for(i=1900; i<2050 && offset>0; i ) {<br> 임시 = lYearDays(i)<br> 오프셋 -= 온도;<br> this.monCyl = 12;<br> }<br> if(오프셋<0) {<br /> 오프셋 = 온도;<br /> 나--;<br /> this.monCyl -= 12;<br /> }<br /> this.year = i;<br /> this.yearCyl=i-1864;<br /> 도약 = 도약월(i); //闰哪个월<br /> this.isLeap = false;<br /> for(i=1; i<13 && offset>0; i ) {<br> if(leap>0 && i==(leap 1) && this.isLeap==false){ //闰月<br> --나; this.isLeap = 사실; temp = 도약일(이.연도);}<br> 그렇지 않으면{<br> temp = 월일(this.year, i);}<br> if(this.isLeap==true && i==(도약 1)) this.isLeap = false; //解除闰월<br> 오프셋 -= 온도;<br> if(this.isLeap == false) this.monCyl ;<br> }<br> if(offset==0 && 도약>0 && i==도약 1)<br> if(this.isLeap){ this.isLeap = false;}<br> else{this.isLeap=true;--i;--this.monCyl;}<br> if(offset this.month=i;<br> this.day=오프셋 1;<br> }<br> //返回公历y年m 1개월의 天数<br> 함수 태양일(y,m){<br> if(m==1)<br> return(((y%4==0)&&(y 0!=0)||(y@0==0))?29:28);<br> 그 외<br> return(solarMonth[m]);<br> }<br> //记录공历와农历某천상의일期<br> 함수 calElement(sYear,sMonth,sDay,week,lYear,lMonth,lDay,isLeap) {<br> this.isToday = false;<br> //공공<br> this.sYear = sYear;<br> this.sMonth = sMonth;<br> this.sDay = sDay;<br> this.week = 주;<br> //农历<br> this.lYear = lYear;<br> this.lMonth = l월;<br> this.lDay = lDay;<br> this.isLeap = isLeap;<br> //节日记录<br> this.lunarFestival = ''; //农历节日<br> this.solarFestival = ''; //공공축일<br> this.solarTerms = ''; //节气<br> }<br> //返回某年的第n个节气为几日(从0小寒起算)<br> 함수 sTerm(y,n) {<br> var offDate = new Date((31556925974.7*(y-1900) sTermInfo[n]*60000) Date.UTC(1900,0,6,2,5));<br> 반환(offDate.getUTCDate())<br> }<br> //保存y年m 1개월의상상关信息<br> var fat=mat=9;<br> var 이브=0;<br> 함수 달력(y,m) {<br> fat=mat=0;<br> var sDObj,lDObj,lY,lM,lD=1,lL,lX=0,tmp1,tmp2;<br> var lDPOS = 새 배열(3);<br> var n = 0;<br> var firstLM = 0;<br> sDObj = 새로운 날짜(y,m,1); //当月第一天的日期<br> this.length = 태양일(y,m); //공공历当月天数<br> this.firstWeek = sDObj.getDay(); //공공历当월1일별期几<br> if ((m 1)==5){fat=sDObj.getDay()}<br> if ((m 1)==6){mat=sDObj.getDay()}<br> for(var i=0;i<this.length;i ) {<br /> if(lD>lX) {<br> sDObj = 새로운 날짜(y,m,i 1); //当月第一天的日期<br> lDObj = 새로운 다이애나데이(sDObj); //农历<br> lY = lDObj.년; //农历年<br> lM = lDObj.월; //农历月<br> lD = lDObj.day; //农历日<br> lL = lDObj.isLeap; //农历是否闰月<br> 1X = 1L? leapDays(lY): 월일(lY,lM); //农历当月最後一天<br> if (lM==12){eve=lX}<br> if(n==0) firstLM = lM;<br> lDPOS[n ] = i-lD 1;<br> }<br> this[i] = new calElement(y,m 1,i 1,nStr1[(i this.firstWeek)%7],lY,lM,lD ,lL);<br> if((i this.firstWeek)%7==0){<br>This[i].color = 'red'; //일요일 색상<br> }<br> }<br> //절기<br> tmp1=sTerm(y,m*2)-1;<br> tmp2=sTerm(y,m*2 1)-1;<br> 이[tmp1].solarTerms = SolarTerm[m*2];<br> This[tmp2].solarTerms = SolarTerm[m*2 1];<br> If((this.firstWeek 12)%7==5) //블랙 프라이데이<br> This[12].solarFestival = '블랙 프라이데이';<br> If(y==tY && m==tM) this[tD-1].isToday = true //오늘<br> }<br> //음력 날짜를 중국어로 표시 <br> 함수 cDay(d){<br> vars;<br> 스위치(d) {<br> 사례 10:<br> s = '음력 10일' 휴식;<br> 사례 20:<br> s = '20';<br> 휴식;<br> 사례 30:<br> s = '서른';<br> 휴식;<br> 기본값:<br> s = nStr2[Math.floor(d/10)];<br> s = nStr1[d];<br> }<br> 반품;<br> }<br> var cld;<br> 함수 drawCld(SY,SM) {<br> var TF=true;<br> var p1=p2="";<br> var i,sD,s,size;<br> cld = 새 달력(SY,SM);<br> GZ.innerHTML = ' ' 동물[(SY-4) ] ']' //황도대<br> for(i=0;i sObj=eval('SD' i);<br> lObj=eval('LD' i);<br> sObj.className = '';<br> sD = i - cld.firstWeek;<br> If(sD>-1 && sD<cld.length></cld.length> sObj.innerHTML = SD 1;<br> If(cld[sD].isToday){ sObj.style.color = '#9900FF';} //오늘의 색상<br> else{sObj.style.color = '';}<br> If(cld[sD].lDay==1){ //음력 월 표시<br> lObj.innerHTML = '<b>' (cld[sD].isLeap?'Leap':'') cld[sD].lMonth '월' (monthDays(cld[sD].lYear,cld[sD].lMonth )==29?'작은':'큰') '</b>';<br> }<br> > ~ var Slfw=Ssfw=null;<br> s=cld[sD].solarFestival;<br> for (var ipp=0;ipp<lFtv.length;ipp ){ //달의 축제<br /> If (parseInt(lFtv[ipp].substr(0,2))==(cld[sD].lMonth)){<br /> If (parseInt(lFtv[ipp].substr(2,4))==(cld[sD].lDay)){<br /> lObj.innerHTML=lFtv[ipp].substr(5);<br /> Slfw=lFtv[ipp].substr(5);<br /> }<br /> }<br /> If (12==(cld[sD].lMonth)){ //새해전야인지 판단<br /> If (eve==(cld[sD].lDay)){lObj.innerHTML="새해 전야";Slfw="새해 전야";}<br /> }<br /> }<br /> for (var ipp=0;ipp<sFtv.length;ipp ){ //그레고리오력 축제<br /> If (parseInt(sFtv[ipp].substr(0,2))==(SM 1)){<br /> If (parseInt(sFtv[ipp].substr(2,4))==(sD 1)){<br />lObj.innerHTML=sFtv[ipp].substr(5);<br /> Ssfw=sFtv[ipp].substr(5);<br /> }<br /> }<br /> }<br /> If ((SM 1)==5){ //어버이날<br /> 만약 (지방==0){<br /> If ((sD 1)==7){Ssfw="어머니날";lObj.innerHTML="어머니날"}<br /> }<br /> else if (fat<9){<br /> If ((sD 1)==((7-fat) 8)){Ssfw="어머니날";lObj.innerHTML="어머니날"}<br /> }<br /> }<br /> If ((SM 1)==6){ //어버이날<br /> if (mat==0){<br /> If ((sD 1)==14){Ssfw="아버지의 날";lObj.innerHTML="아버지의 날"}<br /> }<br /> else if (mat<9){<br /> If ((sD 1)==((7-mat) 15)){Ssfw="아버지의 날";lObj.innerHTML="아버지의 날"}<br /> }<br /> }<br /> > > s=cld[sD].solarTerms;<br /> If(s.length>0) s = s.fontcolor('limegreen'); }<br /> If(s.length>0) {lObj.innerHTML=s;Slfw=s;} //절기<br /> If ((Slfw!=null)&&(Ssfw!=null)){<br /> lObj.innerHTML=Slfw "/" Ssfw;<br /> ~ }<br /> else { //날짜가 아님<br /> sObj.innerHTML = '';<br /> lObj.innerHTML = '';<br /> }<br /> }<br /> }<br /> //드롭다운 목록에서 연도와 월을 선택할 때 사용자 정의 함수 drawCld()를 호출하여 양력 및 음력 관련 정보를 표시합니다<br /> 함수changeCld() {<br /> var y,m;<br /> y=CLD.SY.selectedIndex 1900;<br /> m=CLD.SM.selectedIndex;<br /> drawCld(y,m);<br /> }<br /> //사용자 정의 변수를 사용하여 현재 시스템에 연도, 월, 일을 저장합니다<br /> var Today = 새 날짜();<br /> var tY = Today.getFullYear();<br /> var tM = Today.getMonth();<br /> var tD = Today.getDate();<br /> //페이지가 열리면 드롭다운 목록에 현재 연도와 월이 표시되고, 사용자 정의 함수 drawCld()가 호출되어 양력 및 음력과 관련된 정보가 표시됩니다<br /> 함수 초기() {<br /> CLD.SY.selectedIndex=tY-1900;<br /> CLD.SM.selectedIndex=tM;<br /> drawCld(tY,tM);<br /> }<br /> //--><br> </스크립트> <BODY onload=initial()><br> <센터><br> <양식 이름=CLD><br> <br> <TR><br> <TD align=중간><br> <TABLE border=1 cellpadding="0" cellpacing="0" bordercolordark="#FFFFFF" bordercolor="#ffffff" bordercolorlight="#EEEEEE"><br> <TR bgcolor="#006600"><br> <TD colSpan=7><FONT color=#ffffff style="FONT-SIZE: 9pt">양력 <br> <SELECT name=SY onchange=changeCld() style="FONT-SIZE: 9pt"> <br> <SCRIPT 언어="자바스크립트"><br> for(i=1900;i </스크립트><br> </선택> 年 <SELECT name=SM onchange=changeCld() style="FONT-SIZE: 9pt"> <br> <SCRIPT 언어="자바스크립트"><br> for(i=1;i </스크립트><br> </선택> 月 </FONT> <FONT color=#ffffff face=宋体 id=GZ style="FONT-SIZE: 12pt"></FONT><BR></TD><br> </TR><br> <TR align=중간 bgColor=#e0e0e0><br> <TD width=54 style="font-size:9pt; padding:5pt;">일</TD><br> <TD width=54 style="font-size:9pt ">一</TD><br> <TD width=54 style="font-size:9pt ">두</TD><br> <TD width=54 style="font-size:9pt ">삼</TD><br> <TD width=54 style="font-size:9pt ">사</TD><br> <TD width=54 style="font-size:9pt ">5</TD><br> <TD width=54 style="font-size:9pt ">六</TD></TR><br> <SCRIPT 언어="자바스크립트"><br> var gNum;<br> for(i=0;i document.write('<tr align=center>');<br> for(j=0;j<7;j ) {<br /> gNum = i*7 j;<br /> document.write('<td id="GD' gNum '"><font id="SD' gNum '" size=2 face="Arial Black"');<br /> if(j == 0) document.write(' color=red');<br /> if(j == 6) document.write(' color=#000080');<br /> document.write(' TITLE=""> </font><br><font id="LD' gNum '" size=2 style="font-size:9pt"> </font> </td>');<br> }<br> document.write('</tr>');<br> }<br> </스크립트><br> </표><br> </TD><br> </TR><br> </표><br> <br> </센터><br> </BODY><br> </HTML><br> </div> <p>비常少见的,带节日와节气以及农历的日历特效,希望small伙伴们能够喜欢</p>