jsp 日历的源码(4)
if (day == "") {
form.dayBox[(row*7)+col].style.display = "none";
} else {
form.dayBox[(row*7)+col].value = day;
if (col%7 == 0) form.dayBox[(row*7)+col].style.color = "red";
if (yearNow == year && monthNow == month && dayNow == day) form.dayBox[(row*7)+col].style.color = "blue";;
}
}
}
}
function start_day_in_month ( year, month ) {
var day, daynum, ndays, mnum;
sday = start_day_in_year ( year );
endDay[2] = ( year % 4 ) ? 28 : 29;
if ( month == 1 )
daynum = sday;
else {
ndays = sday;
for ( mnum=2; mnum<month+1; mnum++ )
ndays = ndays + endDay[mnum-1];
daynum = ndays % 7;
}
daynum = (!daynum) ? 7 : daynum;
return (daynum);
}
function start_day_in_year ( year ) {
var y, m, d;
var n;
y = year - 1; m = 13; d = 1;
n = d + 2 * m + ( Math.floor ( ( 0.6 + (m + 1) ) ) + y );
n = n + Math.floor ( ((y / 4) - Math.floor ( (y / 100 ) ) + Math.floor ( ( y / 400 ) ) ) ) + 2 ;
相关新闻>>
- 发表评论
-
- 最新评论 更多>>