本文主要是介绍我写的万年历插件(含天干地支,农历,阳历,节气,各种节假日等),基于MooTools 1.4,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
演示效果图:
插件源代码:
function PL_rili(_id,Option,memo,_edit){//_edit:日曆內的價格可否被編輯
//如果页面中不包含该对象则退出该扩展方法
if(!_id){return false;}
if(_edit==undefined){_edit=false}
var Today=new Date();
var tY=Today.getFullYear();
var tM=Today.getMonth();
var tD=Today.getDate();
//農曆資料
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,0x0a5d0,0x14573,0x052d0,0x0a9a8,0x0e950,0x06aa0,0x0aea6,0x0ab50,0x04b60,0x0aae4,0x0a570,0x05260,0x0f263,0x0d950,0x05b57,0x056a0,0x096d0,0x04dd5,0x04ad0,0x0a4d0,0x0d4d4,0x0d250,0x0d558,0x0b540,0x0b5a0,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);
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 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 cn_mth=new Array("","一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月");
var cn_day=new Array("","初一","初二","初三","初四","初五","初六","初七","初八","初九","初十","十一","十二","十三","十四","十五","十六","十七","十八","十九","二十","廿一","廿二","廿三","廿四","廿五","廿六","廿七","廿八","廿九","三十","卅一");
var wFtv=new Array("0520 母親節","1144 感恩節");//某月的第幾個星期幾
//國曆節日 *表示放假日
var sFtv=new Array(
"0101*元旦","0111 司法節","0115 藥師節","0214 情人節","0215 戲劇節","0228*和平紀念日","0301 兵役節","0308 婦女節","0312 植樹節","0317 國醫節","0320 郵政節",
"0321 氣象節","0325 美術節","0326 廣播節","0329 青年節","0330 出版節","0401 愚人節","0404*兒童節","0405*清明節","0408 衛生節","0501 勞動節","0504 文藝節",
"0505 舞蹈節","0512 護士節","0603 禁煙節","0606 水利節","0609 鐵路節","0615 警察節","0701 漁民節","0711 航海節","0808 父親節","0814 空軍節","0901 記者節",
"0903 軍人節","0909 律師節","0913 法律日","0928 教師節","1006 老人節","1010*國慶日","1021 華僑節","1024 聯合國日","1025 光復節","1031 榮民節","1101 商人節",
"1111 工業節","1112 國父誕辰","1121 防空節","1205 海員節","1210 人權節","1212 憲兵節","1225*行憲紀念日","1227 建築師節","1228 電信節","1231 受信節"
);
//農曆節日 *表示放假日
var lFtv=new Array(
"0100*除夕","0101*春節","0102*回娘家","0103*祭祖","0104 迎神","0105 開市","0109 天公生","0115 元宵節","0202 土地公生","0219 觀世音誕辰","0323 媽祖生日",
"0408 浴彿節","0505*端午節","0701 開鬼門","0707 七夕","0715 中元節","0800 關鬼門","0815*中秋節","0909 重陽節","1208 臘八節","1216 尾牙","1224 送神"
);
//畫月曆
Show(tY,tM,tD);
function Show(_y,_m,_d){
var i,sD;
var cld=new core(_y,_m);
Ganzhi((_y-1900)*12 + _m +14);
css='<style type="text/css">';
css+='#PL_rili_tit{width:100%;font-family:Verdana,arial;font-size:15px;font-weight:bo
这篇关于我写的万年历插件(含天干地支,农历,阳历,节气,各种节假日等),基于MooTools 1.4的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!