Tip: you can modify some code before running
<Script LANGUAGE="JavaScript">Var months = new Array ("1", "2", "3", "4", "5", "6", "7", "8 ", "9", "10", "11", "12"); var daysInMonth = new Array (31, 28, 31, 30, 31, 30, 31, 31,30, 31, 30, 31);/* to move Sunday to Saturday, change * // var days = new Array ("day", "1 ", "2", "3", "4", "5", "6"); var days = new Array ("1", "2", "3 ", "4", "5", "6", "Day"); var classTemp; var today = new getToday (); var year = today. year; var month = today. month; var newCal; var oldDa Te = '1970-03-20 '; // The first payroll function getDays (month, year) {if (1 = month) return (0 = year % 4) & (0! = (Year % 100) | (0 = year % 400 )? 29: 28; else return daysInMonth [month];} function getToday () {this. now = new Date (); if (document. all. year = null | document. all. year. value = '') {this. year = this. now. getFullYear (); this. month = this. now. getMonth (); this. day = this. now. getDate ();} else {// alert (document. all. month. value) this. year = document. all. year. value; this. month = document. all. month. value; this. day = this. now. getDate () ;}// two dates are separated Number of days function DateDiff (sDate1, sDate2) {// sDate1 and sDate2 are in the 2002-12-18 format var aDate, oDate1, oDate2, iDays aDate = sDate1.split ("-") oDate1 = new Date (aDate [1] + '-' + aDate [2] + '-' + aDate [0]) // convert to the 12-18-2002 format aDate = sDate2.split ("-") oDate2 = new Date (aDate [1] + '-' + aDate [2] + '-' + aDate [0]) iDays = parseInt (Math. abs (oDate1-oDate2)/1000/60/60/24) // Convert the number of milliseconds to the number of days return iDays} function Cal Endar () {newCal = new Date (year, month, 1); today = new getToday (); var todayMonth = today. month + 1; var nowDate = today. year + '-' + todayMonth + '-' + today. day; // The current date var nDay = DateDiff (oldDate, nowDate); // number of different days var n = nDay + 1; var nWeek = 0; if (n % 7 = 0) // if the division is normal {nWeek = n/7;} else {nWeek = parseInt (n/7) + 1 ;} // alert (nowDate + '-' + oldDate + '=' + n) // alert (nWeek); var day =-1; var startDay = newCal. getDay () ; // GetDay () the value returned by the method is an integer between 0 and 6 // 0 SUNDAY 1 Monday 2 Tuesday 3 wedday 4 Thursday 5 Friday 6 Saturday // but in addition, 0 is Monday, 6 is Sunday, so you need to convert if (startDay = 0) {startDay = 6;} else {startDay = startDay-1;} var endDay = getDays (newCal. getMonth (), newCal. getFullYear (); var daily = 0; if (today. year = newCal. getFullYear () & (today. month = newCal. getMonth () {day = today. day;} var caltable = document. all. caltable. tBodies. calendar; var in TDaysInMonth = getDays (newCal. getMonth (), newCal. getFullYear (); for (var intWeek = 0; intWeek <caltable. rows. length; intWeek ++) // There are 6 rows in total {for (var intDay = 0; intDay <caltable. rows [intWeek]. cells. length; intDay ++) // There are a total of 7 columns {var cell = caltable. rows [intWeek]. cells [intDay]; // create the nth column of the row var Monte MP = (newCal. getMonth () + 1) <10? ("0" + (newCal. getMonth () + 1) :( newCal. getMonth () + 1); // Display month/* if you want to move Sunday to Saturday, change * // if (intDay = startDay) & (0 = daily) if (intDay = startDay) & (0 = daily) {daily = 1;} var daytemp = daily <10? ("0" + daily) :( daily); var d = "<" + newCal. getFullYear () + "-" + Monte MP + "-" + daytemp + ">"; if (daily> 0) & (daily <= intDaysInMonth )) {var nnDaily = today. year + '-' + todayMonth + '-' + daily; var nnDay = DateDiff (oldDate, nnDaily); // different days var nn = nnDay + 1; // alert (oldDate + '-' + nnDaily + '=' + nn) var dailyWeek = 0; if (nn % 7 = 0) // If {dailyWeek = nn/7;} else {dailyWeek = parseInt (nn/7) + 1;} // alert (nWeek) // nWeek Current week // for (var I = 1; I <= nWeek; I ++) // From the first week till now this week // {if (nWeek = dailyWeek | nWeek = dailyWeek-1) // {// if (day = daily) cell. className = "DayNow"; // if it is today, the style is: DayNow // else if (intDay = 5) cell. className = "DaySat"; // if it is Saturday, the style is: DaySat // else if (intDay = 6) cell. className = "DaySun"; // if it is Sunday, the style is: DaySunif (nWeek = dailyWeek) {if (intDay = 4) {cell. className = "DayNow";} else {cell. className = "Day" ;}} else ce Ll. className = "Day";} //} cell. innerText = daily; daily ++;} else {cell. className = "CalendarTD"; cell. innerText = "" ;}}} document. all. year. value = year; document. all. month. value = month + 1;} function subMonth () {if (month-1) <0) {month = 11; year = year-1 ;} else {month = month-1;} Calendar ();} function addMonth () {if (month + 1)> 11) {month = 0; year = year + 1;} else {month = month + 1;} Calendar ();} function setDate () {if (document. all. month . Value <1 | document. all. month. value> 12) {alert ("The valid range of the month is between 1 and 12! "); Return;} year = Math. ceil (document. all. year. value); month = Math. ceil (document. all. month. value-1); Calendar ();}</script><Script>Function buttonOver () {var obj = {%event.srcelement=obj.runtimestyle.css Text = "background-color: # FFFFFF"; // obj. className = "Hover";} function buttonOut () {var obj = {}event.srcelement?#settimeout(function({{obj.runtimestyle.css Text = "" ;}, 300 );}</script><Style>Input {font-family: verdana; font-size: 9pt; text-decoration: none; background-color: # FFFFFF; height: 20px; border: 1px solid #666666; color: #000000 ;}. calendar {font-family: verdana; text-decoration: none; width: 170; background-color: # C0D0E8; font-size: 9pt; border: 0px dotted #1C6FA5 ;}. calendarTD {font-family: verdana; font-size: 7pt; color: #000000; background-color: # f6f6f6; height: 20px; width: 11%; text-align: center ;}. title {font-family: verdana; font-size: 11pt; font-weight: normal; height: 24px; text-align: center; color: #333333; text-decoration: none; background-color: # A4B9D7; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-bottom-style: 1px; border-top-color: #999999; border-right-color: #999999; border-bottom-color: #999999; border-left-color: #999999 ;}. day {font-family: verdana; font-size: 7pt; color: #243F65; background-color: # E5E9F2; height: 20px; width: 11%; text-align: center ;}. daySat {font-family: verdana; font-size: 7pt; color: # FF0000; text-decoration: none; background-color: # E5E9F2; text-align: center; height: 18px; width: 12% ;}. daySun {font-family: verdana; font-size: 7pt; color: # FF0000; text-decoration: none; background-color: # E5E9F2; text-align: center; height: 18px; width: 12% ;}. dayNow {font-family: verdana; font-size: 7pt; font-weight: bold; color: #000000; background-color: # FFFFFF; height: 20px; text-align: center ;}. dayTitle {font-family: verdana; font-size: 9pt; color: #000000; background-color: # C0D0E8; height: 20px; width: 11%; text-align: center ;}. daySatTitle {font-family: verdana; font-size: 9pt; color: # FF0000; text-decoration: none; background-color: # C0D0E8; text-align: center; height: 20px; width: 12% ;}. daySunTitle {font-family: verdana; font-size: 9pt; color: # FF0000; text-decoration: none; background-color: # C0D0E8; text-align: center; height: 20px; width: 12% ;}. dayButton {font-family: Webdings; font-size: 9pt; font-weight: bold; color: #243F65; cursor: hand; text-decoration: none ;}</style><table border="0" cellpadding="0" cellspacing="1" class="Calendar" id="caltable"><thead> <tr align="center" valign="middle"> <td colspan="7" class="Title"> 3 <input name="year" type="text" size="4" maxlength="4" onkeydown="if (event.keyCode==13){setDate()}" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onpaste="this.value=this.value.replace(/[^0-9]/g,'')">Year<input name="month" type="text" size="1" maxlength="2" onkeydown="if (event.keyCode==13){setDate()}" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onpaste="this.value=this.value.replace(/[^0-9]/g,'')">Month 4</td> </tr> <tr align="center" valign="middle"> <Script LANGUAGE="JavaScript">/* If you want to move Sunday to Saturday, change it here * // document. write ("<TD class=DaySunTitle id=diary >"+ Days [0] +"</tD>"); // Display" day "// for (var intLoop = 1; intLoop <days. length-1; intLoop ++) // {// document. write ("<TD class=DayTitle id=diary>"+ Days [intLoop] +"</tD>"); // Display: one, two, three, four, five; //} // document. write ("<TD class=DaySatTitle id=diary>"+ Days [intLoop] +"</tD>"); // Display: 6; for (var intLoop = 0; intLoop <days. length-2; intLoop ++) // Change 1 to 0 and 1 to 2 {document. write ("<TD class=DayTitle id=diary>"+ Days [intLoop] +"</tD>"); // Display: one, two, three, four, five;} document. write ("<TD class=DaySatTitle id=diary>"+ Days [intLoop] +"</tD>"); // Display: 6; document. write ("<TD class=DaySunTitle id=diary >"+ Days [intLoop + 1] +"</tD>"); // Change days [0] to days [intLoop + 1]</script> </tR> </thead><TBODY border=1 cellspacing="0" cellpadding="0" ID="calendar" ALIGN=CENTER ONCLICK="getDiary()"> <Script LANGUAGE="JavaScript">For (var intWeeks = 0; intWeeks <6; intWeeks ++) {document. write ("<TR >"); For (var intDays = 0; intDays <days. length; intDays ++) document. write ("<TD class=CalendarTD onMouseover='buttonOver();' onMouseOut='buttonOut();'></tD>"); Document. write ("</tR>");}</script></tBODY></tABLE><Script LANGUAGE="JavaScript">Calendar ();</script>
Tip: you can modify some code before running