Jquery 创建六个月日历的日期选择器

Jquery 创建六个月日历的日期选择器,jquery,datepicker,Jquery,Datepicker,我正在用日历做一页。这个想法是把一年中的前六个月放在页面上,用一个按钮显示其他六个月 我尝试使用数据采集器,在网上搜索,使用不同的方法,但我没有做到这一点 有人知道热,在不到六个月,分别放 您可以将defaultDate设置为本年年初。结合numberOfMonths和stepMonths方法,我们应该能够实现与您所寻找的类似的功能 JS: datepicker对象接受numberOfMonths作为参数,它接受一个月数组,或一个表示要显示多少个月的数字。 // Get the first d

我正在用日历做一页。这个想法是把一年中的前六个月放在页面上,用一个按钮显示其他六个月

我尝试使用数据采集器,在网上搜索,使用不同的方法,但我没有做到这一点


有人知道热,在不到六个月,分别放

您可以将
defaultDate
设置为本年年初。结合
numberOfMonths
stepMonths
方法,我们应该能够实现与您所寻找的类似的功能

JS:


datepicker对象接受
numberOfMonths
作为参数,它接受一个月数组,或一个表示要显示多少个月的数字。
// Get the first day of the year (ie. Jan 1, 2013)
var firstOfTheYear = new Date(new Date().getFullYear(), 0, 1);

// Set your datepicker options
$(".calendar").datepicker({
    numberOfMonths: [2, 3],
    stepMonths: 6,
    defaultDate: firstOfTheYear
});