有没有办法突出从周一到下周日的当周?
答案 0 :(得分:0)
我不知道在drupal中这样做是否有用,但这是用jQuery和datepicker模块完成的。本周的天数将被赋予css类highlight
。
$(function() {
var nowDate = new Date();
nowDate.setHours(0,0,0,0)
var nowTime = nowDate.getTime();
var dpFirstDay = 0; //what day is the first day of the week (0 = sunday, 1 = monday...)
$("#dp").datepicker({
firstDay: dpFirstDay,
beforeShowDay: function(date) {
var d = new Date(date);
d.setDate( d.getDate() - (((d.getDay() - dpFirstDay)%7)+7)%7 );
for (var i = 0; i < 7; i++) {
if (d.getTime() == nowTime)
return [true, "highlight"];
d.setDate(d.getDate() + 1);
}
return [true, ""];
}
});
});