📄 index.htm
字号:
<html>
<head>
<TITLE>寿星万年历2008版</TITLE>
<META content="寿星万年历;万年历;农历;农历计算;算法;天文算法;伊斯兰历;回历;节气;交节时刻" name=keywords>
<style>
td {font-family:宋体; font-size:12px; line-height:150%}
.bd0 {border: 0px}
.bd1 {border: 1px solid #000000}
.bd2 {border: 2px solid #000000}
.dTop {border-top: 1px solid #000000}
.dBot {border-bottom: 1px solid #000000}
.dRig {border-right: 1px solid #000000}
.dLef {border-left: 1px solid #000000}
.dRB {border-right: 1 solid #000000;border-bottom: 1 solid #000000}
.dRT {border-right: 1 solid #000000;border-top: 1 solid #000000}
.dBot2 {border-bottom: 1px solid #C0C0C0}
</style>
<!--js1S-->
<script language=javascript src=tools.js></script><!--工具函数-->
<script language=javascript src=eph.js></script> <!--星历模块-->
<script language=javascript src=JW.js></script> <!--全国城市经纬数据库及皇帝纪年数据库-->
<script language=javascript src=lunar.js></script><!--日历物件-->
<script language=javascript src=vml.js></script> <!--画图物件-->
<!--js1E-->
</head>
<body>
<center>
<table width=770 class=bd1 cellpadding=0 cellspacing=0>
<tr>
<td width=270 valign=top style='line-height: 150%' class=dRig>
<table width="100%" cellspacing=0 cellpadding=2>
<tr><td class=dBot style='font-size:16px;color:#80C000;font-weight:bold' align=center>寿星万年历 2008版(V3.24)</td></tr>
<tr><td class=dBot align=center>
<!--本地时间-->
<span id=Clock1 style='color:red;font-weight:bold'></span><br>
<!--外地时间-->
<select id=Sel_zhou onchange="change_zhou()"></select> <select id=Sel_dq onchange="change_dq()"></select><br>
<span id=Sel_sqsm></span> <span id=Clock2 style='font-weight:bold;color:blue'></span><br>
<!--经纬度-->
<select id=Sel1 onchange="change(0)" style="width:80px"></select> <select id=Sel2 onchange="change2()"></select><br>
<span id=Cal_zdzb></span>
</td></tr>
<tr><td class=dBot align=center id=Cal5></td></tr><!--日月出没-->
<tr><td class=dBot align=center id=Cal4></td></tr><!--月相节气-->
<!--星历显示-->
<tr><td align=center> 暂停<input id=Cal_pause type=checkbox> <input type=button onclick="showPage(3)" value="图表"></td></tr>
<tr><td id=Cal_zb></td></tr>
</table>
</td>
<td width=500 valign=top>
<!--月历显示区-->
<table width="100%" cellspacing=0 cellpadding=2>
<!--年月日输入-->
<tr><td class=tBot2 bgcolor='#E0E0FF'>
公元<input type=text id=Cal_y size=4 value=2008>年<input type=text maxlength=2 id=Cal_m size=2 value=1>月
<input type=button value="确定" onclick='getLunar()'>
<a href='javascript:changeYear(0)'>▲</a>
<a href='javascript:changeYear(1)'>▼</a>
<a href='javascript:changeMonth(0)'>↑</a>
<a href='javascript:changeMonth(1)'>↓</a>
<input type=button onclick='changeMonth(2)' value='今'>
<a href='javascript:showPage(2)'>年历</a>
<a href='readme.htm'>帮助</a>
</td></tr>
<!--月历及摘要-->
<tr><td style="background-color:#0000A0" style="color=#FFFF00" id=Cal2></td></tr>
<tr><td class=dBot2 id=page1></td></tr><!--月历表-->
<tr><td class=dBot2 id=page2 style="display:none">
公元<input type=text size=4 id=Cal_y2 value=2008>年<input type=checkbox id=Cal_tg checked>时刻/干支
<input type=button onclick="getNianLi(0)" value="确定">
<input type=button onclick="getNianLi(1)" value="▲">
<input type=button onclick="getNianLi(-1)" value="▼">
<input type=button onclick="showPage(1)" value="关闭"><br>
<div id=Cal7></div></td></tr><!--年历表-->
<tr><td class=dBot2 id=page3 style="display:none">
<!--图表区-->
<table width="100%" cellspacing=0 cellpadding=0>
<tr><td>
公元<input id=Cb_y type=text size=4 value=2008>年<input id=Cb_m type=text size=2 value=8 maxleng=2>月<input id=Cb_d type=text size=2 value=1>日
<input id=Cb_t type=text size=8 value="18:17:15"> UTC/TD<input id=Cb_ut type=checkbox checked>
<input type=button value="确定" onclick="tu_calc(0,0)">
<input type=button value="今" onclick="tu_calc(1,0)">
<input type=button value="关闭" onclick="showPage(1)"><br>
经度<input id=Cb_J type=text size=10 value=0>
纬度<input id=Cb_W type=text size=10 value=0>(地标)
海拨<input id=Cb_high type=text size=4 value=0>千米
<br>
步长<input type=text id=Cb_step size=3 value=300 checked>秒 <input type=checkbox id=Cb_pause>暂停
<input type=button value="单步↑" onclick="tu_calc(2,0)">
<input type=button value="单步↓" onclick="tu_calc(3,0)">
<input type=button value="上月" onclick="tu_calc(4,0)">
<input type=button value="下月↓" onclick="tu_calc(5,0)">
<input type=button value="食甚参考" onclick="tu_calc(0,1)"><br>
横坐标是方位角,纵坐标是高度角。(两圆相切初亏),请在接近日食计算食甚
</td></tr>
<tr><td id=Cb_zb></td></tr>
<tr><td><v:group id=Can1 style="width:480;height:300"/></td></tr>
</table>
</td></tr>
<!--年历区-->
<tr><td class=dBot2>公元
<input type=text id=Cml_y size=4 maxlength=5 value='2008'>年
<input type=text id=Cml_m size=2 maxlength=2 value='01'>月
<input type=text id=Cml_d size=2 maxlength=2 value='01'>日
<input type=text id=Cml_his size=8 value='12:00:00'>
<input type=button value="确定" onclick='ML_calc()'>
</td></tr>
<tr><td class=dBot2 id=Cal6></td></tr>
<!--版权区-->
<tr><td class=dBot2>
<b>提示:</b>如果按住ctrl键不放,再将鼠标移出日历区,即可保持该日信息摘要不变;日月升降是本地时间,气朔时刻是北京时间;输入公元前212年方法是B212或*212或-211;BC4713至9999年有效,<font color=red><b><i>BC722年以后与实历相符。</i></b></font>“表一”为当日真分点地心坐标,“表二”为站心坐标。
</td></tr>
<tr><td class=dBot2 align=center> <font color=red> 邮箱 xunmeng04@163.com 许剑伟(福建莆田第十中学)保留版权 © 2008</font></td></tr>
</table>
</td>
</tr>
</table>
<div id=Cal_pan style="font-size:12px; position:absolute; z-index:1; width:160;FILTER: shadow(color=#333333,direction=135);display:none">
<div id=Cal_pan_in style="background-color:#3333A0;width:150;text-align:center;line-height: 150%; color:#FFFFFF; display:block;filter:Alpha(opacity=80)">abc</div><br>
</div>
<script language=javascript>
var lun = new Lunar(); //月历全局对象
var msc = new sun_moon(); //日月计算全局对象
var curJD; //现在日期
var curTZ; //当前时区
var tu1={
can:'', //画布
x0:0, y0:0, w:0, h:0, dx:0, dy:0, //坐标参数
qb1:{fillcolor:"#FF0000",filled:"true",stroked:"true",strokecolor:"#FFFF00",strokeweight:"1px",strokestyle:"solid"}, //铅笔1
qb2:{fillcolor:"#FF0000",filled:"true",stroked:"true",strokecolor:"#00cc00",strokeweight:"1px",strokestyle:"solid"}, //铅笔2
init:function(can){ //初始化坐标等
this.can=can;
ht.canvas=can;
//坐标设置
this.w=String(can.style.width).replace(/[^0-9]/g,'');
this.h=String(can.style.height).replace(/[^0-9]/g,'');
can.coordsize=this.w + ',' + this.h;
this.dx = int2( (this.w-this.x0)/8.5 );
this.dy = int2( (this.h-this.y0)/6.5 );
this.x0 = int2( (this.w - this.dx*8)/2 ) -5;
this.y0 = int2( (this.h - this.dy*6)/2 );
this.y0 = this.h-this.y0;
var p = ht.shape('');
p.p_moveto(this.x0, this.y0-this.dy*6);
p.p_lineto(this.x0, this.y0);
p.p_lineto(this.x0+this.dx*8, this.y0);
p.filled=false;
p.p_save();
for(i=1;i<=6;i++){ //画y刻度
c=this.y0-i*this.dy;
p.p_moveto(this.x0-3,c);
p.p_lineto(this.x0+3,c);
p2 = ht.textbox(this.x0+10,c-8,30,15,15*i);
p2.filled=false;
p2.stroked=false;
}
for(i=0;i<=8;i++){ //画x刻度
c=this.x0+i*this.dx;
p.p_moveto(c,this.y0);
p.p_lineto(c,this.y0-10);
if(i==0||i==8) continue;
p2 = ht.textbox(c-5,this.y0+5,30,20,30*(i-4));
p2.filled=false;
p2.stroked=false;
}
p.p_save();
//创建太阳和月亮
this.vs=65, this.vx=130, this.vy=100; //vs对应32角分
this.sun2 =ht.oval(0,0, this.vs,this.vs); this.sun2.moveto2(this.vx,this.vy); this.sun2.stroked=false;
this.moon2=ht.oval(0,0, this.vs,this.vs); this.moon2.moveto2(this.vx,this.vy); this.moon2.stroked=false; this.moon2.fillcolor='#a0a000';
this.sun =ht.oval(50,50,7,7); this.sun.stroked=false;
this.moon=ht.oval(50,50,7,7); this.moon.stroked=false; this.moon.fillcolor='#a0a000';
},
move:function(el,J,W){ //移动天体
J = rad2mrad(J); if(J>Math.PI) J-=pi2;
J =J*180/Math.PI/30+4, W =W*180/Math.PI/15; //经纬度转为格数
if(J>8||J<0) { el.style.display = 'none'; return; }
el.style.display = 'block';
el.moveto2(this.x0+J*this.dx, this.y0-W*this.dy);
},
move2:function(J1,W1,J2,W2, mr,sr){ //转入月日坐标差及视半径(前者为月),半径单位是角秒。未做大气折射的修正
var dJ=J1-J2, dW=W1-W2;
dJ = rad2mrad(dJ); if(dJ>Math.PI) dJ-=pi2; //转为 -180度到180度
dJ *= Math.cos((W1+W2)/2)*rad/60, dW *= rad/60; //转为平面
if(Math.abs(dJ)>60 || Math.abs(dW)>60){
this.sun2.style.display='none';
this.moon2.style.display='none';
return;
}else{
this.sun2.style.display='block';
this.moon2.style.display='block';
}
sr = this.vs/16*sr/60; //日面大小转为点数
mr = this.vs/16*mr/60; //月面大小转为点数
this.sun2.resize(sr,sr); //重置日月的大小,以便精准观测日食
this.moon2.resize(mr,mr);
dJ = this.vs/32*dJ; dW = this.vs/32*dW; //转为点数
this.sun2.moveto2( this.vx, this.vy );
this.moon2.moveto2( this.vx+dJ, this.vy-dW );
}
};
tu1.init(Can1); //画布初始化
function tu_calc(ly,xm){ //ly是取时间的方式,xm是计算的项目
var jd; //J2000起算的儒略日数(当地时间)
var vJ = (Cb_J.value-0)/180*Math.PI;
var vW = (Cb_W.value-0)/180*Math.PI;
//取时间
if(ly!=1){ //取屏幕时间
jd = String(Cb_t.value).split(':');
jd[0]-=0, jd[1]-=0,jd[2]-=0; jd = ((jd[2]/60+jd[1])/60+jd[0])/24;
jd = JD.JD( year2Ayear(Cb_y.value), Cb_m.value-0, (Cb_d.value-0)+jd ) - J2000;
}
if(ly==1) jd = (new Date())/86400000-10957.5-curTZ/24; //取现在时间(UTC)
if(ly==2) jd -= Cb_step.value/86400;
if(ly==3) jd += Cb_step.value/86400;
if(ly==4) jd = XL.MS_aLon_t2( Math.floor((jd-29.53+8)/29.5306)*pi2 )*36525 - curTZ/24-JD.deltatT2(jd);
if(ly==5) jd = XL.MS_aLon_t2( Math.floor((jd+29.53+8)/29.5306)*pi2 )*36525 - curTZ/24-JD.deltatT2(jd);
//置时间
var ts=JD.setFromJD_str(jd+J2000);
Cb_y.value = ts.substr(0,5)-0;
Cb_m.value = ts.substr(6,2);
Cb_d.value = ts.substr(9,2);
Cb_t.value = ts.substr(12,8);
if(ly==1||ly==4||ly==5) Cb_ut.checked=true;
if(Cb_ut.checked) jd += curTZ/24+JD.deltatT2(jd); //转为力学时
if(xm==1){//食甚计算
jd=msc.ceMax(jd, vJ,vW, Cb_high.value-0);
if(Cb_ut.checked) jd -= curTZ/24+JD.deltatT2(jd); //转为UTC(本地时间)
alert( JD.setFromJD_str(jd+J2000) );
return;
}
msc.calc(jd,vJ,vW,Cb_high.value-0);
tu1.move(tu1.sun, msc.sPJ,msc.sPW);
tu1.move(tu1.moon,msc.mPJ,msc.mPW);
var J1=msc.mDJ,W1=msc.mDW, J2=msc.sDJ, W2=msc.sDW, sr=msc.sRad, mr=msc.mRad;//用未做大气折射的来计算日食
var d1=ZB.j1_j2(J1,W1,J2,W2)*rad,d0=mr+sr;
tu1.move2(J1,W1,J2,W2,mr,sr);
//数据显示
var s='';
if(msc.zx_W!=100)
s = '<font color=red>中心食位置: 经 ' + msc.zx_J/Math.PI*180 + ' 纬 ' + msc.zx_W/Math.PI*180+'</font>';
Cb_zb.innerHTML = '日月中心视距 '+m2fm( d1,2,0 ) +' 日月半径和 '+m2fm(d0,2,0) +' 距相切 '+m2fm(d1-d0,2,0) +'<br>'+s;
Cal_zb.innerHTML=msc.toHTML(1);
}
//==========================
//页面生成有关的函数
//==========================
function showPage(pg){
Cb_pause.checked=true;
Cal_pause.checked=true;
page1.style.display='none';
page2.style.display='none';
page3.style.display='none';
if(pg==1){page1.style.display='block'; Cal_pause.checked=false;}
if(pg==2) page2.style.display='block';
if(pg==3) page3.style.display='block';
}
/********************
当前时间初始化,在屏幕上显示时间、保存本地时区信息等
*********************/
function set_date_screen(){ //把当前时间置于屏幕的便入框之中
var now=new Date();
curTZ = now.getTimezoneOffset()/60; //时区 -8为北京时
curJD = now/86400000-10957.5 - curTZ/24; //J2000起算的儒略日数(当前本地时间)
JD.setFromJD(curJD+J2000);
Cml_y.value = JD.Y;
Cml_m.value = JD.M;
Cml_d.value = JD.D;
Cml_his.value = JD.h+':'+JD.m+':'+JD.s.toFixed(0);
Cal_y.value = JD.Y;
Cal_m.value = JD.M;
curJD=int2(curJD+0.5);
}
set_date_screen();
/****************
外地时间选择
****************/
function change_dq(){ //国家或地区改变
var i,v = Sel_dq.options[Sel_dq.selectedIndex].value;
v = v.split('#');
Sel_dq.v = v[0]; //地区时差
Sel_dq.rg= v[1]; //日光节约参数
Sel_sqsm.innerHTML=v[2]; //时区说明
}
function change_zhou(){ //洲别改变
var i, ob = SQv[ Sel_zhou.options[Sel_zhou.selectedIndex].value-0 ]; //某洲数组
Sel_dq.length=0;
for(i=1; i<ob.length; i+=2) addOp(Sel_dq,ob[i+1],ob[i]);
change_dq();
}
for(i=0;i<SQv.length;i++) addOp(document.all.Sel_zhou,i,SQv[i][0]);
change_zhou();
function show_clock(t){ //显示时钟,传入日期对象
var h = Sel_dq.v-0, rg='';
var v = Sel_dq.rg;
var jd = t/86400000-10957.5 + h/24; //J2000起算的儒略日数(当地时间)
Clock1.innerHTML = t.toLocaleString();
if(v){
var y1 = JD.Y, y2=y1; //该时所在年份
var m1 = v.substr(0,2)-0, m2 = v.substr(5,2)-0;
if(m2<m1) y2++;
//nnweek(y,m,n,w)求y年m月第n个星期w的jd
var J1 = obb.nnweek( y1, m1, v.substr(2,1), v.substr(3,1)-0 )-0.5-J2000 +(v.charCodeAt(4)-97)/24;
var J2 = obb.nnweek( y2, m2, v.substr(7,1), v.substr(8,1)-0 )-0.5-J2000 +(v.charCodeAt(9)-97)/24;
if(jd>=J1 && jd<J2) jd+=1/24, rg='<font color=red>¤</font>'; //夏令时
}
JD.setFromJD(jd+J2000);
Clock2.innerHTML = JD.D+'日 '+JD.h+':'+JD.m+':'+int2(JD.s) + rg; //与了与clock1同步,秒数取整而不四舍五入
}
/****************
地理经纬度选择的页面控制函数
****************/
function change2(){
var i,v = new JWdecode( Sel2.options[Sel2.selectedIndex].value );
Sel2.vJ = v.J; Sel2.vW = v.W;
Cb_J.value=(v.J/Math.PI*180).toFixed(6), Cb_W.value=(v.W/Math.PI*180).toFixed(6);
Cal_zdzb.innerHTML = '经度(向西为正) '+rad2str2(v.J) + ' 纬度 '+rad2str2(v.W);
showMessD(-2);
setCookie('Sel1',Sel1.selectedIndex);
setCookie('Sel2',Sel2.selectedIndex);
}
function change(){
Sel2.length=0;
var i, ob=JWv[ Sel1.options[Sel1.selectedIndex].value-0 ];
for(i=1; i<ob.length; i++)
addOp( Sel2, ob[i].substr(0,4), ob[i].substr(4,ob[i].length-4) );
change2();
}
var i;
for(i=0;i<JWv.length;i++) addOp(document.all.Sel1,i,JWv[i][0]);
var seI1=getCookie('Sel1');
var seI2=getCookie('Sel2');
Sel1.selectedIndex = seI1; change();
Sel2.selectedIndex = seI2; change2();
/**********************
月历的年、月跳转控制函数
**********************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -