XTN*_*XTN 5 javascript jquery jquery-ui datepicker
所以我的问题非常简单.我想在datepicker上启用特定日期,例如http://tokenposts.blogspot.fr/2011/05/jquery-datepicker-disable-specific.html但我只想要任何月份的最后一天,例如30/06/2012,31/07/2012,......
任何线索?
这就是你可以做到的...
获取给定年份和月份的最后一天:
function getLastDayOfYearAndMonth(year, month)
{
return(new Date((new Date(year, month + 1, 1)) - 1)).getDate();
}
Run Code Online (Sandbox Code Playgroud)
检查beforeShowDay事件日期是否是上个月的某一天:
$('.selector').datepicker(
{
beforeShowDay: function(date)
{
// getDate() returns the day [ 0 to 31 ]
if (date.getDate() ==
getLastDayOfYearAndMonth(date.getFullYear(), date.getMonth()))
{
return [true, ''];
}
return [false, ''];
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6133 次 |
| 最近记录: |