in saga-web/src/main/resources/static/js/date.js [470:536]
Calendar.prototype.bindData = function () {
var calendar = this;
var dateArray = this.getMonthViewArray(this.date.getFullYear(), this.date
.getMonth());
var tds = this.getElementById("calendarTable").getElementsByTagName("td");
for (var i = 0; i < tds.length; i++) {
tds[i].style.backgroundColor = calendar.colors["td_bg_out"];
tds[i].onclick = function () {
return;
}
tds[i].onmouseover = function () {
return;
}
tds[i].onmouseout = function () {
return;
}
if (i > dateArray.length - 1) {
break;
}
tds[i].innerHTML = dateArray[i];
if (dateArray[i] != " ") {
tds[i].onclick = function () {
if (calendar.dateControl != null) {
calendar.dateControl.value = new Date(calendar.date
.getFullYear(), calendar.date.getMonth(),
this.innerHTML, calendar.getHour(), calendar
.getMinute(), calendar.getSecond())
.format(calendar.dateFormatStyle);
}
calendar.hide();
}
tds[i].onmouseover = function () {
this.style.backgroundColor = calendar.colors["td_bg_over"];
}
tds[i].onmouseout = function () {
this.style.backgroundColor = calendar.colors["td_bg_out"];
}
if (new Date().format("yyyy-MM-dd") == new Date(calendar.date
.getFullYear(), calendar.date.getMonth(), dateArray[i])
.format("yyyy-MM-dd")) {
tds[i].style.backgroundColor = calendar.colors["cur_bg"];
tds[i].onmouseover = function () {
this.style.backgroundColor = calendar.colors["td_bg_over"];
}
tds[i].onmouseout = function () {
this.style.backgroundColor = calendar.colors["cur_bg"];
}
}// end if
// 设置已被选择的日期单元格背影色
if (calendar.dateControl != null
&& calendar.dateControl.value == new Date(calendar.date
.getFullYear(), calendar.date.getMonth(),
dateArray[i], calendar.getHour(), calendar
.getMinute(), calendar.getSecond())
.format(calendar.dateFormatStyle)) {
tds[i].style.backgroundColor = calendar.colors["sel_bg"];
tds[i].onmouseover = function () {
this.style.backgroundColor = calendar.colors["td_bg_over"];
}
tds[i].onmouseout = function () {
this.style.backgroundColor = calendar.colors["sel_bg"];
}
}
}
}
}