我发现了这个 datepicker 事件,但不适用于 IE。我不知道这段代码有什么问题。
var Event = function(text, className) {
this.text = text;
this.className = className;
};
var events = {};
events[new Date("18/Jan/2013")] = new Event("Drinks @ Seymours - Alumni Event", "Yes");
events[new Date("16/Jan/2013")] = new Event("Retired Staff Luncheon", "Yes");
events[new Date("13/Jan2013")] = new Event("October Spring Lunch - Alumni Event", "Yes");
$("#dates").datepicker({
dateFormat: 'dd/M/yy',
firstDay: 1,
showOtherMonths: true,
onSelect: function(date) {
$('#CAT_Custom_241423').val(date);
$('#submit-btn-webapp').trigger('click');
},
beforeShowDay: addClass
});
function addClass(date) {
var event=events[date];
if(event){
return[true,event.className,event.text];
}
else {
return[true,'',''];
}
}
它在 ff,Google Chrome 上运行良好。这是 jsfiddle 上的工作代码