BLOG calendar JS code

xiaoxiao2021-03-06  77

"Calendarhover"; var today = new gettoday (); var year = Today.year; var new = Today.month; var newcal; // Get a month of days Function getDays (Month, Year) {if (1 == Month) Return ((0 == Year% 4) && (0! = (Year% 100))) || (0 == Year% 400)? 29: 28; Else Return Daysinmonth [Month];} // Getting the day Information Function GetToday () {this.now = new date (); this.year = this.now.GetFullyear (); this.month = this.now.getMonth (); this.day = this.now.getdate () }

// Generate calendar function Calendar () {newcal = new date (year, month, 1); // The first day of the current month Today = New gettoday (); var day = -1; // Used to determine if the calendar is For the day var startday = newcal.getday (); // The month start time var endday = getDays (newcal.getmonth (), newcal.getfullyear ()); // At the end of the month, VAR Daily = 0; // Used to generate a calendar Niki IF ((Today.Year == Newcal.getFullyear ()) && (Today.Month == Newcal.getMonth ())) DAY = Today.day; var caltable = document.all.caltable.tbodies.calendar ; // Get a collection of calendar table var intDaysinmonth = getDays (newcal.getmonth (), newcal.getfullyear ()); // gets the number of days // generates calendar for (var intwek = 0; intWeek // Select style IF (day == daily) cell.className =" Calendarnow "; Else IF (DiaryDays.indexof) d)! = - 1) cell.classname = "calendarlink"; else if (intDay == 6) cell.className = "CalendardAysat"; else if (intDay == 0) cell.className = "CalendardAysun"; else Cell. ClassName = "CalendartD"; // Generate Value IF ((Daily> 0) && (DAILY <

= INTDAYSINMONTH)) {Cell.innertext = Daily; daily ;} else 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 ();} // Get response event function getDiary () {var mon = (newcal.getmonth () 1) <10? ("0" 1) :( Newcal.getMonth () 1); var day = event.srcelement.innertext <10? ("0" Event.Srcelement.innertext ) :( Event.srcelement.innertext); var D = "<" newcal.getfullyear () " " " " day ">"; if ("TD" == Event.srcelement.tagname) IF ((""! = event.srcelement.innerText) && (DiaryDays.indexof (D)! = - 1)) {Diary.Location = "/ listenWind / Archive /" NewCal.getFullyEar () "/" MON "/" day ". aspx"; window.location.href = diary.location;}}

Function setDate () {if (Document.all.Mont.Value <1 || Document.all.month.Value> 12) {alert ("The monthly valid range is between 1-12!"); return;} year = Math.ceil (Document.all.year.Value); Month = Math.ceil (Document.all.Mont.Value-1); Calendar ();}

Month [ next month ] [ Previous month