目录
一、介绍
业余时间写的,供有缘人参考使用,大家看下有没有错误。本代码在浏览器本地运行,无获取及存储任何个人信息。感谢《道医天乙神针》提供的针灸方法,使普通人也可以自救救命。
网页运行界面(业余勿喷):
根据这位网友的说法,有三点需要注意:
1.子时以夜12点为分界
2.需取正太阳时
3.闰月以闰月当月十五为上下月的分界
出处:道医后天灵穴针法
二、程序使用方法:
1.复制代码
2.粘贴到html在线运行网站,点击运行即可。html在线运行网站例如:HTML/CSS/Javascript在线代码运行工具 | 菜鸟教程
代码如下(闰月的计算待完善,闰月时请勿使用):
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>计算穴位</title>
<style type="text/css">
.STYLE1 {
font-family: "宋体";
font-size: 16px;
}
</style>
</head>
<body>
<h1 class="STYLE1">请输入出生年月日时(阳历)</h1>
<span class="STYLE1">
</span>
<h1 class="STYLE1">(其中“时”请输入0-23的整数)</h1>
<span class="STYLE1">
</span>
<h1 class="STYLE1">(“年“请输入1900-2100”的整数)</h1>
<form>
<label><span class="STYLE1">出生年:</span>
<input type="number" id="birth_year"></label><br>
<label><span class="STYLE1">出生月:</span>
<input type="number" id="birth_month"></label><br>
<label><span class="STYLE1">出生日:</span>
<input type="number" id="birth_day"></label><br>
<label><span class="STYLE1">出生小时:</span>
<input type="number" id="birth_hour"></label><br>
<h1 class="STYLE1">当前(阳历)时间(23点时可修改):</h1>
<label><span class="STYLE1">当前年:</span>
<input type="number" id="now_year"></label><br>
<label><span class="STYLE1">当前月:</span>
<input type="number" id="now_month"></label><br>
<label><span class="STYLE1">当前日:</span>
<input type="number" id="now_day"></label><br>
<label><span class="STYLE1">当前小时:</span>
<input type="number" id="now_hour"></label><br>
<button type="button" onClick="calculate()"><span class="STYLE1">计算穴位</span></button>
</form>
<form>
<label>
<span class="STYLE1" id="result"></span>
</label>
</form>
<script>
//-----------------------------------------
/**公历年月日转农历数据 返回json**/
//calendar.solar2lunar(1987,11,01);
/**农历年月日转公历年月日**/
//calendar.lunar2solar(1987,9,10);
//调用以上方法后返回类似如下object(json)具体以上就不需要解释了吧!
//c开头的是公历各属性值 l开头的自然就是农历咯 gz开头的就是天干地支纪年的数据啦~
/*
{
Animal: "兔",
IDayCn: "初十",
IMonthCn: "九月",
Term: null,
astro: "天蝎座",
cDay: 1,
cMonth: 11,
cYear: 1987,
gzDay: "甲寅",
gzMonth: "庚戌",
gzYear: "丁卯",
isLeap: false,
isTerm: false,
isToday: false,
lDay: 10,
lMonth: 9,
lYear: 1987,
nWeek: 7,
ncWeek: "星期日"
}
*/
//该代码还有其他可以调用的方法,请自己查看代码中的详细注释
//--------------------------------------------------
/**
* @1900-2100区间内的公历、农历互转
* @charset UTF-8
* @Author Jea杨(JJonline@JJonline.Cn)
* @Time 2014-7-21
* @Time 2016-8-13 Fixed 2033hex、Attribution Annals
* @Time 2016-9-25 Fixed lunar LeapMonth Param Bug
* @Version 1.0.2
* @公历转农历:calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0]
* @农历转公历:calendar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0]
*/
var calendar = {
/**
* 农历1900-2100的润大小信息表
* @Array Of Property
* @return Hex
*/
lunarInfo:[0x04bd8,0x04ae0,0x0a570,0x054d5,0x0d260,0x0d950,0x16554,0x056a0,0x09ad0,0x055d2,//1900-1909
0x04ae0,0x0a5b6,0x0a4d0,0x0d250,0x1d255,0x0b540,0x0d6a0,0x0ada2,0x095b0,0x14977,//1910-1919
0x04970,0x0a4b0,0x0b4b5,0x06a50,0x06d40,0x1ab54,0x02b60,0x09570,0x052f2,0x04970,//1920-1929
0x06566,0x0d4a0,0x0ea50,0x06e95,0x05ad0,0x02b60,0x186e3,0x092e0,0x1c8d7,0x0c950,//1930-1939
0x0d4a0,0x1d8a6,0x0b550,0x056a0,0x1a5b4,0x025d0,0x092d0,0x0d2b2,0x0a950,0x0b557,//1940-1949
0x06ca0,0x0b550,0x15355,0x04da0,0x0a5b0,0x14573,0x052b0,0x0a9a8,0x0e950,0x06aa0,//1950-1959
0x0aea6,0x0ab50,0x04b60,0x0aae4,0x0a570,0x05260,0x0f263,0x0d950,0x05b57,0x056a0,//1960-1969
0x096d0,0x04dd5,0x04ad0,0x0a4d0,0x0d4d4,0x0d250,0x0d558,0x0b540,0x0b6a0,0x195a6,//1970-1979
0x095b0,0x049b0,0x0a974,0x0a4b0,0x0b27a,0x06a50,0x06d40,0x0af46,0x0ab60,0x09570,//1980-1989
0x04af5,0x04970,0x064b0,0x074a3,0x0ea50,0x06b58,0x055c0,0x0ab60,0x096d5,0x092e0,//1990-1999
0x0c960,0x0d954,0x0d4a0,0x0da50,0x07552,0x056a0,0x0abb7,0x025d0,0x092d0,0x0cab5,//2000-2009
0x0a950,0x0b4a0,0x0baa4,0x0ad50,0x055d9,0x04ba0,0x0a5b0,0x15176,0x052b0,0x0a930,//2010-2019
0x07954,0x06aa0,0x0ad50,0x05b52,0x04b60,0x0a6e6,0x0a4e0,0x0d260,0x0ea65,0x0d530,//2020-2029
0x05aa0,0x076a3,0x096d0,0x04afb,0x04ad0,0x0a4d0,0x1d0b6,0x0d250,0x0d520,0x0dd45,//2030-2039
0x0b5a0,0x056d0,0x055b2,0x049b0,0x0a577,0x0a4b0,0x0aa50,0x1b255,0x06d20,0x0ada0,//2040-2049
/**Add By JJonline@JJonline.Cn**/
0x14b63,0x09370,0x049f8,0x04970,0x064b0,0x168a6,0x0ea50, 0x06b20,0x1a6c4,0x0aae0,//2050-2059
0x0a2e0,0x0d2e3,0x0c960,0x0d557,0x0d4a0,0x0da50,0x05d55,0x056a0,0x0a6d0,0x055d4,//2060-2069
0x052d0,0x0a9b8,0x0a950,0x0b4a0,0x0b6a6,0x0ad50,0x055a0,0x0aba4,0x0a5b0,0x052b0,//2070-2079
0x0b273,0x06930,0x07337,0x06aa0,0x0ad50,0x14b55,0x04b60,0x0a570,0x054e4,0x0d160,//2080-2089
0x0e968,0x0d520,0x0daa0,0x16aa6,0x056d0,0x04ae0,0x0a9d4,0x0a2d0,0x0d150,0x0f252,//2090-2099
0x0d520],//2100
/**
* 公历每个月份的天数普通表
* @Array Of Property
* @return Number
*/
solarMonth:[31,28,31,30,31,30,31,31,30,31,30,31],
/**
* 天干地支之天干速查表
* @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"]
* @return Cn string
*/
Gan:["\u7532","\u4e59","\u4e19","\u4e01","\u620a","\u5df1","\u5e9a","\u8f9b","\u58ec","\u7678"],