2011-03-11 23 views

回答

0

我分叉的小提琴,用新yearRange參數修改了它: http://jsfiddle.net/marcosfromero/Tcnfq/

$("#datet").datepicker({ 
     minDate:SetDate('-100y'), 
     maxDate:SetDate('+0d'), 
     firstDay: 1, 
     changeMonth: true, 
     showButtonPanel: true, 
     changeYear: true, 
    --> yearRange: 'c-100,c+00' <-- 
    }); 

jQueryUI datepicker source code

yearRange: 'c-10:c+10', // Range of years to display in drop-down, 
      // either relative to today's year (-nn:+nn), relative to currently displayed year 
      // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) 

您設置minDate as ('-100y'),這就是爲什麼我用c-100(現在減去100)。

您設置maxDate('+0d'),這就是爲什麼我使用c+00(當前加零)。

+0

它的工作。謝謝你的幫助。 – maycil 2011-03-11 14:41:22

0
$("#datet").datepicker({ 
      minDate:SetDate('-1000y'),// simply change this value to 
      maxDate:SetDate('+0d'),// and this if you wanna go more into future dates 
      firstDay: 1, 
      changeMonth: true, 
      showButtonPanel: true, 
      changeYear: true, 
     }); 


    }); 
+0

我無法在列表中看到完整的可選年份。這不是我預期的正確答案。 – maycil 2011-03-11 13:52:28

+0

你是什麼意思完整的可選年份? – Val 2011-03-11 14:03:04

相關問題