aSeptik:
是肯定的:
這裏是我的HTML代碼:
<div class="calendars">
<div class="left">
<span class="head">Anreise</span>
<div id="navfrom"></div>
</div>
<div class="right">
<span class="head">Abreise</span>
<div id="navto"></div>
</div>
</div>
我的JS代碼:
$('#navfrom, #navto').datepicker(
{
beforeShow: customRangeInline,
dateFormat: "dd.mm.y",
firstDay: 1,
changeFirstDay: false
});
而且CustomRangeInline功能:
function customRangeInline(input)
{
var min = new Date(2008, 11 - 1, 1);
var dateMin = min;
var dateMax = null;
var dayRange = 5;
if (input.id == "navfrom")
{
if ($("#navto").datepicker("getDate") != null)
{
dateMin = $("#navto").datepicker("getDate");
dateMin.setDate(dateMin.getDate());
if (dateMin < min)
{
dateMin = min;
}
}
}
else if (input.id == "navto")
{
dateMax = new Date(); //Set this to your absolute maximum date
if ($("#navfrom").datepicker("getDate") != null)
{
dateMin = $("#navfrom").datepicker("getDate");
var rangeMax = new Date(dateMin.getFullYear(), dateMin.getMonth(), dateMin.getDate() + dayRange);
if(rangeMax > dateMax)
{
dateMax = rangeMax;
}
}
}
return {
minDate: dateMin,
maxDate: dateMax
};
}
你可以發佈你的實際的HTML和JS代碼!? – 2010-05-08 17:17:12