如何在已选择的某些日期加载jQuery datePicker的multimonth插件?

时间:2009-09-21 01:58:51

标签: javascript jquery datepicker

我正好在这里使用这个脚本:
http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/

我有一个multiMonth插件,并启用了多个选择。

我希望能够在加载时已经选择了某些日期,这些日期来自数据库
我找到了两条可能的线索来帮助我,但由于我还没有严格学习JS,我无法做出正面或反面。
http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/renderCalendarBankHolidays.html http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerDefaultToday.html

这是我现在使用的代码:

<script type="text/javascript" charset="utf-8">
   jQuery(function() {
      jQuery('#multimonth').datePickerMultiMonth({
         numMonths: 12,
         inline: true,
         selectMultiple: true,
         startDate: '01/09/2009', // DD/MM/YY
         month: 8, // 0=JAN  1=FEB ...
         year: 2009
      }).bind(
         'dpMonthChanged',
         function(event, displayedMonth, displayedYear) {
          //uncomment if you have firebug and want to confirm this works as expected...
          //console.log('dpMonthChanged', arguments);
      }).bind(
         'dateSelected',
         function(event, date, jQuerytd, status) {
         //uncomment if you have firebug and want to confirm this works as expected...
         //console.log('dateSelected', arguments);
      }).val(
         new Date().asString()).trigger('change');
      jQuery('#getSelected').bind(
         'click',
         function(e) {
            alert(jQuery('#multimonth').dpmmGetSelected());
            return false;
      });
   });
</script>

并且这部分未被选中,我从今天的选择日期演示

中选择了它
.val(new Date().asString()).trigger('change');

1 个答案:

答案 0 :(得分:0)