After saving the following code as a JS file, you can reference it on the page where it needs to be displayed. The Code is as follows:
- // JScript File
- Calendar = new date ();
- Day = calendar. getday ();
- Month = calendar. getmonth ();
- Date = calendar. getdate ();
- Year = calendar. getyear ();
- If (year <100) year = 1900 + year;
- Cent = parseint (Year/100 );
- G = year % 19;
- K = parseint (cent-17)/25 );
- I = (cent-parseint (cent/4)-parseint (cent-k)/3) + 19 * g + 15) % 30;
- I = I-parseint (I/28) * (1-parseint (I/28) * parseint (29/(I + 1) * parseint (21-g) /11 ));
- J = (Year + parseint (Year/4) + I + 2-cent + parseint (cent/4) % 7;
- L = I-j;
- Emonth = 3 + parseint (L + 40)/44 );
- Edate = L + 28-31 * parseint (emonth/4 ));
- Emonth --;
- VaR dayname = new array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday ");
- VaR monthname =
- New array ", "October", "November", "December ");
- Document. Write ("<font color = ff0000>" + year + "year ");
- Document. Write (monthname [month]);
- Document. Write (date + "day ");
- Document. Write (dayname [Day] + "" + "</font> ");
- // January (the February Festival, which is the same as the following .)
- Month ++;
- VaR datearray = new array ();
- Datearray [0] = new array ("2008/1/1", "2008/2/7", "2008/2/21", "2008/4/4", "2008/5/1", "2008/7/1", "2008/8/1 ", "2008/9/14", "2008/10/1", "2008/12/25 ",
- "Medium", "2009/1/26", "2009/2/9", "2009/3/8", "2009/4/4", "medium", "medium", "2009/8/1", "2009/9/3", "2008/10/1 ", "2009/12/25 ",
- "Expiration", "2010/2/14", "2010/2/28", "2010/3/8", "2010/4/4", "Expiration", "2010/8/1", "2010/9/22", "2010/10/1 ", "2010/12/25 ",
- "Region", "region", "2011/2/17", "2011/3/8", "2011/4/4", "region", "2011/7/1 1/8/1", "2011/9/12", "2011/10/1 ", "2011/12/25 ",
- "Expiration", "2012/1/23", "Expiration", "2012/3/8", "2012/4/4", "Expiration", "Expiration", "2012/8/1", "2012/9/30", "2012/10/1 ", "2012/12/25 ");
- Datearray [1] = new array ("New Year's Day", "Spring Festival", "Lantern Festival", "Women's Day", "Tomb Sweeping Day", "Labor Day", "Party Building Festival ", "Jianjun Festival", "Mid-Autumn Festival", "National Day", "Christmas ",
- "New Year's Day", "Spring Festival", "Lantern Festival", "Women's Day", "Tomb Sweeping Day", "Labor Day", "Party Building Festival", "army building Festival", "Mid-Autumn Festival ", "National Day", "Christmas ",
- "New Year's Day", "Spring Festival", "Lantern Festival", "Women's Day", "Tomb Sweeping Day", "Labor Day", "Party Building Festival", "army building Festival", "Mid-Autumn Festival ", "National Day", "Christmas ",
- "New Year's Day", "Spring Festival", "Lantern Festival", "Women's Day", "Tomb Sweeping Day", "Labor Day", "Party Building Festival", "army building Festival", "Mid-Autumn Festival ", "National Day", "Christmas ",
- "New Year's Day", "Spring Festival", "Lantern Festival", "Women's Day", "Tomb Sweeping Day", "Labor Day", "Party Building Festival", "army building Festival", "Mid-Autumn Festival ", "National Day", "Christmas ");
- VaR jier = ""
- VaR tians = ""
- For (I = 0; I <datearray [0]. length; I ++)
- {
- VaR urodz = new date (datearray [0] [I]);
- VaR S = datearray [1] [I];
- VaR now = new date ();
- VaR Ile = urodz. gettime ()-Now. gettime ();
- VaR DNI = math. Floor (Ile/(1000*60*60*24 ));
- If (DNI> 0)
- {
- Jier = s
- Tians = DNI
- Break;
- }
- }
- Document. Write ("distance" + jier + "and" + tians + "day ")
- Document. Write ("<br> </font> ");
The reference method code is as follows:
- <Script language = "JavaScript" src = JScript. js> </SCRIPT>
The above script can also be bound to the database, which is not described here.