" //The parseInt function parses the string argument as a signed decimal integer. var io = 'Start'; var mthIdx = parseInt(month); var endday = getDaysInMonth(mthIdx, year); var prevyear = parseInt(year) - 1; var nextyear = parseInt(year) + 1; var today = new Date(); var thisDate = today.getDate(); var thisDay = today.getDay(); var thisMonth = today.getMonth(); var thisyear = today.getYear(); if (thisyear < 2000) // Y2K Fix, Yoan Hillion thisyear = thisyear + 1900; //year header - by default: two years displayed if (thisyear == year) { // display calendar for current year and the following year calendar+="" + year + " / " calendar+="" + nextyear + "" } else { // display calendar for selected year calendar+="" + prevyear + " / " calendar+="" + year + "" } //months table calendar +="
| " + monthShortName[monthindex] + " | " } else { calendar+="" + monthShortName[monthindex] + " | " } } calendar+= "||||
| Clear | |||||
"
//month header
var index = (mthIdx-1)
calendar += "" + monthName[index] + " " + year + "
"
calendar +=""
calendar +="
"
//writes in the day of the week labels
calendar +=" "
calendar +=" "
wholeDate = month + "/01/" + year
thedate = new Date(wholeDate)
firstDay = thedate.getDay()
selectedmonth = mthIdx;
selectedyear = year
var lastDay = (endday + firstDay+1)
calendar +="Sun "
calendar +="Mon "
calendar +="Tue "
calendar +="Wed "
calendar +="Thu "
calendar +="Fri "
calendar +="Sat "
calendar +=""
for (var i = 1; i < lastDay; i++)
{
if (i <= firstDay)
{
// 'empty' boxes prior to first day
calendar +=" "
}
else
{
// Current Year, previous month
if (((month -1) < thisMonth) && (year == thisyear)){
// Disabled dates
calendar +=""+(i-firstDay)+" "
} else {
// Current Year, Current Month, previous day
if (((i-firstDay) < thisDate) && ((month -1) == thisMonth) && (year == thisyear)){
// Disabled dates
calendar +=""+(i-firstDay)+" "
} else {
// Current Year, Current Month, Current day
if (((i-firstDay) == thisDate) && ((month-1) == thisMonth) && (year == thisyear)){
// highlighted day
calendar +=""+(i-firstDay)+" "
} else {
// The Other dates
calendar +=""+(i-firstDay)+" "
}
}
}
}
//must start new row after each week
if (i % 7 == 0 && i != lastDay)
{
calendar +=""
}
}
calendar +="