Document. The write (getDateString ());
//JavaScript Document
The function getBit (m, n) {return (m> N) & amp; 1; }
The function lunarDate (d) {
Var numString="ten";
Var monString="is the 23456789 believed la";
Xd4a x41a95=var Cal [0, 0, 0 xda5, 0 x20b55, 0 x56a, 0 x7155b, 0 x25d, 0 x92d, 0 x5192b, 0 xa95, 0 xb4a, 0 x416aa, 0 xad5, 0 x90ab5, 0 x4ba, 0 xa5b, 0 x60a57, 0 x52b, 0 xa93, 0 x40e95];
Var madd=,31,59,90,120,151,181,212,243,273,304,334 [0];
Var total, m, n, k;
Var isEnd=false;
Var TMP=d.g etYear ();
If (tmpTotal=(TMP - 2001) * 365 + math.h floor ((TMP - 2001)/4) + madd [d.g etMonth ()] + d.g etDate () - 23.
If (d.g etYear () % 4==0 & amp; & D.g etMonth () & gt; 1) total++;
For (m=0;; M++)
{
K=(Cal [m] <0 XFFF)? And;
For (n=k; n>=0; N -)
{
If (total<=29 + getBit (Cal [m], n))
{
IsEnd=true;
break;
}
Total=total - 29 - getBit (Cal [m], n);
}
If (isEnd) break;
}
Var cYear=2001 + m;
Var cMonth=k - n + 1;
Var cDay=total;
If (k==12)
{
If (cMonth==Math. Floor (Cal [m]/0 x10000) + 1)
1 - cMonth cMonth=;
If (cMonth> Math. Floor (Cal [m]/0 x10000) + 1)
CMonth -;
}
Var cHour=Math. Floor ((d.g etHours () + 3)/2);
Var TMP="";
If (cMonth<1)
{
TMP +="leap";
TMP +=monString. CharAt (cMonth - 1);
}
The else
{TMP +=monString. CharAt (cMonth - 1); }
TMP +="on";
TMP +=(cDay<11)?" "At the beginning: ((cDay<20)?" 10 ": ((cDay<30)?" 21 ":" 30 "));
If (cDay % 10!=0 | | cDay==10)
TMP +=numString. CharAt ((cDay - 1) % 10);
Return the TMP;
}
The function getDateString () {
Var d=new Date ();
In var ymd=d.g etFullYear () + "" + (d.g etMonth () + 1) +" month "+ d.g etDate () +", ";
Var week=[' day ', 'a', '2', '3', '4', '5', '6'].
Var w="week" + week [d.g etDay ()];
Var="lunar" + lunarDate l (d);
The console. The log (ymd + "" + w +" "+ l)
Return ymd + "" +" "+ w + l;
}
Then, we introduce into your code, set encoding UTF8
<script SRC="https://bbs.csdn.net/rmfy/js/myDay.js" language="JavaScript" charset="utf-8" & gt; </script>
Open a browser, found that Chinese garbled

Look inside the network, is also the code

CodePudding user response:
Perhaps the encoding of the file itself has problem, reset