Scripts com festivais e calendários lunares:
A cópia do código é a seguinte:
<html>
<head>
<meta http-equiv = "content-type" content = "text/html; charset = gb2312">
<title> calendário com calendário lunar </title>
<Script Language = "JavaScript">
<!-
var lunarinfo = nova matriz (
0x04bd8,0x04e0,0x0a570,0x054d5,0x0d260,0x0d950,0x16554,0x056a0,0x09ad0,0x055d2,
0x04e0,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,0x0x0ea50,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,0x0d45,
0x0b5a0,0x056d0,0x055b2,0x049b0,0x0a577,0x0a4b0,0x0aa50,0x1b255,0x06d20,0x0ada0)
var solarmonth = nova matriz (31,28,31,30,31,30,31,31,31,30,31);
Var Animals = New Array ("Rat", "Ox", "Tigre", "Rabbit", "Dragão", "Cobra", "Cavalo", "Ovelha", "Macaco", "Frango", "Dog", "Porco");
var solarTerm = new Array("Little Cold", "Great Cold", "Beginning of Spring", "Rain Water", "Jingzhe", "Spring Equinox", "Qingming", "Green Rain", "Beginning of Summer", "Little Man", "Graining Seeds", "Summer Solar", "Little Heat", "Great Heat", "Beginning of Autumn", "Eat Heat", "White Dew", "Autumn Equinox", "Cold Dew "," Frost Descend "," Low Snow "," Alta Snow "," Solstício de Inverno ");
var storminfo = novo Array (0,21208.42467.63836.85337.107014.128867.150921.173149.195551.218072.240693,26 3343.285989.308563.331033.353350.375494.397447.419210.440795.462224.483532.504758);
var nstr1 = new Array ('dia', 'um', 'dois', 'três', 'quatro', 'cinco', 'seis', 'sete', 'oito', 'nove', 'doze');
var nstr2 = novo array ('primeiro', 'ten', 'vinte', 'trinta');
// festival do calendário gregoriano
var sftv = nova matriz (
"0101 Dia de Ano Novo",
"0214 Dia dos Namorados",
"0308 Dia da Mulher",
"0312 Day Arbor",
"0315 Dia dos Direitos do Consumidor",
"0401 do dia do tolo de abril",
"0501 Dia do Trabalho",
"0504 da juventude",
"0512 Dia das Enfermeiras",
"0601 Dia das Crianças",
"0701 Party Founding Day",
"0801 Dia do Exército",
"0910 Dia do Professor",
"0928 nascimento de Confúcio",
"1001 Dia Nacional",
"1006 Dia de idosos",
"1024 Dia das Nações Unidas",
"1224 Véspera de Natal",
"1225 Christmas")
// festival lunar lunar
var lftv = nova matriz (
"0101 Spring Festival",
"0115 Lantern Festival",
"0505 Dragon Boat Festival",
"0707 Dia dos Namorados Chinês",
"0715 Festival Zhongyuan",
"0815 Festival no meio do outono",
"0909 Nona Double Festival",
"1208 Laba Festival",
"1224 Little New Year")
// retorna ao número total de dias no ano Y do calendário lunar
função lyeardays (y) {
var i, soma = 348;
for (i = 0x8000; i> 0x8; i >> = 1) soma+= (lunarinfo [y-1900] e i)? 1: 0;
retornar (soma+saltos (y));
}
// retorna ao número de dias no mês bissexto do ano lunar Y
Função saltos (y) {
if (leapmonth (y)) retornar ((lunarinfo [y-1900] e 0x10000)? 30: 29);
caso contrário, retornar (0);
}
// julga que o mês no calendário lunar no ano Y é um mês bissexto, não um mês bissexto para retornar a 0
Função Leapmonth (y) {
return (lunarinfo [y-1900] e 0xf);
}
// retorna ao número total de dias no ano e mês do calendário lunar
Função mensais (y, m) {
retornar ((Lunarinfo [Y-1900] & (0x10000 >> m))? 30:29);
}
// Calcule a data lunar do primeiro dia do mês atual e a data lunar do primeiro dia do calendário lunar do mês atual.
função dianaday (objdate) {
var i, salto = 0, temp = 0;
var com base = nova data (1900,0,31);
var offset = (objdate - baseado)/86400000;
this.daycyl = deslocamento+40;
this.moncyl = 14;
for (i = 1900; i <2050 && offset> 0; i ++) {
temp = lyeardays (i)
deslocamento -= temp;
this.moncyl += 12;
}
if (deslocamento <0) {
deslocamento += temp;
eu--;
this.moncyl -= 12;
}
this.year = i;
this.yearcyl = i-1864;
salto = salto (i); // que mês é salto
this.isLeap = false;
for (i = 1; i <13 && offset> 0; i ++) {
if (salto> 0 && i == (Leap+1) && this.isisheap == false) {// Mês salgado
--eu; this.isLeap = true; temp = saltos (this.year);}
outro{
Temp = Days (this.year, i);}
if (this.isisheap == true && i == (salto+1)) this.isisheap = false; // Libere o mês bisseiro
deslocamento -= temp;
if (this.isLeap == false) this.moncyl ++;
}
if (offset == 0 && Leap> 0 && i == Leap+1)
if (this.isleap) {this.isisheap = false;}
else {this.isleap = true;-i;-this.moncyl;}
if (deslocamento <0) {offset+= temp;-i;-this.moncyl;}
this.month = i;
this.day = deslocamento+1;
}
// retorna ao número de dias no ano de janeiro do calendário gregoriano
função solardays (y, m) {
if (m == 1)
return (((y%4 == 0) && (y%100! = 0) || (y%400 == 0))? 29:28);
outro
return (solarmonth [m]);
}
// registra as datas do calendário gregoriano e do dia do calendário lunar
função calelement (syear, smonth, sday, semana, lyear, lmonth, lday, isleap) {
this.istoday = false;
// calendário gregoriano
this.Syear = syear;
this.smonth = smonth;
this.sday = sday;
this.week = semana;
//calendário lunar
this.lyear = lyear;
this.lmonth = lmonth;
this.lday = Lday;
this.isLeap = Isleap;
// Records festivos
this.Lunarfestival = ''; // Festival Lunar
this.solarfestival = ''; // festivais gregorianos
this.solarterms = ''; //Solar
}
// retorna ao enésimo termo solar de um certo ano a quantos dias (a partir de 0 Xiaohan)
função esterme (y, n) {
var offdate = nova data ((31556925974.7*(y-1900)+sterminfo [n]*60000)+date.utc (1900,0,6,2,5));
Return (offdate.getutcdate ())
}
// Salve as informações relevantes sobre o ano y M+ janeiro
var de gordura = mat = 9;
var Eve = 0;
Calendário da função (y, m) {
gordura = mat = 0;
var sdobj, ldobj, ly, lm, ld = 1, ll, lx = 0, tmp1, tmp2;
var ldPos = nova matriz (3);
var n = 0;
var primeirolm = 0;
sdobj = nova data (y, m, 1); // Data do primeiro dia do mês
this.length = solardays (y, m); // O número de dias no mês do calendário gregoriano
this.firstweek = sdobj.getday (); // que dia da semana no 1º do mês do calendário gregoriano
if ((m+1) == 5) {gord = sdobj.getday ()}
if ((m+1) == 6) {mat = sdobj.getday ()}
for (var i = 0; i <this.length; i ++) {
if (ld> lx) {
sdobj = nova data (y, m, i+1); // Data do primeiro dia do mês
ldobj = new Dianaday (sdobj); //Calendário lunar
ly = ldobj.year; // Ano lunar
lm = ldobj.month; // mês lunar
ld = ldobj.day; // Dia lunar
ll = ldobj.isleap; // é o mês do salto do calendário lunar
lx = ll? Saltos (ly): meses (ly, LM); // O último dia do mês lunar
if (lm == 12) {Eve = lx}
if (n == 0) primeirolm = lm;
LDPOS [n ++] = i-ld+1;
}
este [i] = novo calelemento (y, m+1, i+1, nstr1 [(i+this.firstweek)%7], ly, lm, ld ++, ll);
if ((i+this.firstweek)%7 == 0) {
este [i] .color = 'vermelho'; // cor de domingo
}
}
// Termo solar solar
tmp1 = estermagem (y, m*2) -1;
tmp2 = estermagem (y, m*2+1) -1;
este [tmp1] .Solarterms = SolarTerm [M*2];
este [tmp2] .Solarterms = solarterm [m*2+1];
if ((this.FirstWeek+12)%7 == 5) // Black Friday
Este [12] .Solarfestival += 'Black Friday';
if (y == ty && m == tm) this [td-1] .istoday = true; //Hoje
}
// mostra a data do calendário lunar em chinês
função cday (d) {
var s;
Switch (d) {
Caso 10:
s = 'décimo dia do primeiro mês lunar'; quebrar;
Caso 20:
s = 'vinte'; quebrar;
quebrar;
Caso 30:
s = 'trinta'; quebrar;
quebrar;
padrão:
s = nstr2 [Math.floor (d/10)];
S += NSTR1 [D%10];
}
retorno (s);
}
var cld;
função drawcld (sy, sm) {
var tf = true;
var p1 = p2 = "";
var i, sd, s, tamanho;
CLD = novo calendário (SY, SM);
Gz.innerhtml = '【'+animais [(sy-4)%12]+']'; //Zodíaco
para (i = 0; i <42; i ++) {
SOBJ = EVALL ('SD'+ I);
Lobj = EVALL ('LD'+ I);
Sobj.className = '';
sd = i - cld.firstweek;
if (sd> -1 && sd <cld.length) {// na data
Sobj.innerhtml = sd+1;
if (cld [sd] .istoday) {Sobj.style.color = '#9900FF';} // A cor de hoje
else {Sobj.style.color = '';}
if (cld [sd] .lday == 1) {// mostrar o mês lunar
lobj.innerhtml = '<b>' + (cld [sd] .islape?
}
else {lobj.innerhtml = cday (cLd [sd] .lday);} // mostra o dia lunar
var slfw = ssfw = null;
s = CLD [SD] .Solarfestival;
for (var ipp = 0; ipp <lftv.length; ipp ++) {// festival lunar lunar
if (parseint (lftv [ipp] .substr (0,2)) == (cld [sd] .lmonth)) {
if (parseint (lftv [ipp] .substr (2,4)) == (cld [sd] .lday)) {
lobj.innerhtml = lftv [ipp] .substr (5);
Slfw = lftv [ipp] .substr (5);
}
}
if (12 == (cld [sd] .lmonth)) {// julgar se é véspera de ano novo ou não
if (Eve == (cld [sd] .lday)) {lobj.innerhtml = "véspera de ano novo"; slfw = "véspera de ano novo";}
}
}
for (var ipp = 0; ipp <sftv.length; ipp ++) {// festival de calendário gregoriano
if (parseint (sftv [ipp] .substr (0,2)) == (sm+1)) {
if (parseint (sftv [ipp] .substr (2,4)) == (sd+1)) {
lobj.innerhtml = sftv [ipp] .substr (5);
Ssfw = sftv [ipp] .substr (5);
}
}
}
if ((sm+1) == 5) {// Dia das Mães
if (gordo == 0) {
if ((sd+1) == 7) {ssfw = "dia das mães"; lobj.innerhtml = "dia das mães"}
}
caso contrário, se (gordo <9) {
if (((sd+1) == ((7-gordura) +8)) {ssfw = "dia das mães"; lobj.innerhtml = "dia das mães"}
}
}
if ((sm+1) == 6) {// Dia dos Pais
if (mat == 0) {
if ((SD+1) == 14) {ssfw = "Dia dos Pais"; lobj.innerhtml = "Dia do Pai"}}
}
else if (mat <9) {
if ((SD+1) == ((7-MAT) +15)) {ssfw = "Dia dos Pais"; lobj.innerhtml = "Dia dos Pais"}
}
}
if (s.length <= 0) {// Defina a cor do termo solar
s = CLD [SD] .Solarterms;
if (s.length> 0) s = s.fontcolor ('cal -limegreen');
}
if (s.Length> 0) {lobj.innerhtml = s; slfw = s;} // solar
if ((slfw! = null) && (ssfw! = null)) {
lobj.innerhtml = slfw+"/"+ssfw;
}
}
else {// não-data
Sobj.innerhtml = '';
lobj.innerhtml = '';
}
}
}
// Ao selecionar o ano e o mês na lista suspensa, ligue para a função personalizada drawcld () para exibir informações relevantes sobre o calendário gregoriano e o calendário lunar
função changeCld () {
var y, m;
y = cld.sy.SelectedIndex+1900;
m = cld.sm.SelectedIndex;
drawcld (y, m);
}
// Use variáveis personalizadas para salvar o ano, mês e dia no sistema atual
var hoje = new Date ();
var ty = Today.getlyear ();
var tm = Today.getMonth ();
var td = Today.getDate ();
// Ao abrir a página, exiba o ano e o mês atual na lista suspensa e ligue para a função personalizada drawcld () para exibir informações relevantes sobre o calendário gregoriano e o calendário lunar.
função inicial () {
Cld.sy.SelectedIndex = Ty-1900;
Cld.sm.SelectedIndex = tm;
drawcld (ty, tm);
}
//->
</Script>
<Corpo onload = inicial ()>
<Center>
<Nome de forma = cld>
<Tabela>
<tr>
<Td align = Middle>
<Tabela Border = 1 CellPadding = "0" CellPacing = "0" BorderColordark = "#ffffff" borderColor = "#ffffff" borderColorlight = "#eeeee">
<Tr bgcolor = "#006600">
<Td colspan = 7> <font color =#ffffff style = "font-size: 9pt"> calendário gregoriano
<Select name = synchange = changeCld () style = "font-size: 9pt">
<Script Language = "JavaScript">
para (i = 1900; i <2050; i ++) document.write ('<pution>'+i);
</Script>
</Select> ano <select name = sm onchange = changeCld () style = "font-size: 9pt">
<Script Language = "JavaScript">
para (i = 1; i <13; i ++) document.write ('<pution>'+i);
</Script>
</Select> mês </font> <font color =#ffffff face = 宋 id = gz style = "font-size: 12pt"> </font> <br> </td>
</tr>
<Tr alinhe = meio bgcolor =#e0e0e0>
<Td width = 54 style = "font-size: 9pt; preenchimento: 5pt;"> dia </td>
<Td width = 54 style = "font-size: 9pt"> um </td>
<Td width = 54 style = "font-size: 9pt"> dois </td>
<Td width = 54 style = "font-size: 9pt"> três </td>
<Td width = 54 style = "font-size: 9pt"> quatro </td>
<Td width = 54 style = "font-size: 9pt"> cinco </td>
<Td width = 54 style = "font-size: 9pt"> seis </td> </tr>
<Script Language = "JavaScript">
var gnum;
para (i = 0; i <6; i ++) {
document.write ('<tr align = Center>');
for (j = 0; j <7; j ++) {
gnum = i*7+j;
document.write ('<td id = "gd' + gnum + '"> <font id = "sd' + gnum + 'size = 2 face =" arial preto "');
if (j == 0) document.write ('color = vermelho');
if (j == 6) document.write ('color =#000080');
document.write ('title = ""> </font> <br> <font id = "ld' + gnum + '" size = 2 style = "font-size: 9pt"> </font> </td>');
}
document.write ('</tr>');
}
</Script>
</Tabela>
</td>
</tr>
</Tabela>
</morm>
</Central>
</Body>
</html>
Muito raro, com efeitos calendários com festivais e termos solares e calendários lunares. Espero que seus amigos gostem.