2010-06-28 61 views

回答

0

我不知道這是否有助於在drupal中完成,但這是如何使用jQuery和datepicker模塊完成的。本週的日子將被授予css類highlight

Demo

$(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, ""]; 
     } 
    }); 
});