我想禁用过去的日期并显示短信"您无法选择过去的日期"在datepicker日历中使用({minDate:0}),但我无法理解我如何在现有代码中使用它。
这是我的代码:
<script>
var form, colourField;
$(function() {
$( "#datepicker-13" ).datepicker({onSelect: function(dateText, inst) {
({ minDate: 0})
var mySplitResult;
mySplitResult = dateText.split("/");
for(i = 2; i < mySplitResult.length; i++)
{
}
mySplitResult[2] = (mySplitResult[2] % 100 == 0) ? (mySplitResult[2] % 400 === 0) : (mySplitResult[2] % 4 === 0);
if(mySplitResult[2]== true){
showDiv();
}
else{
showDiv();
}
}
})
});
</script>
<script>
function showDiv() {
document.getElementById('welcomeDiv').style.display = "block";
}
</script>
&#13;
您的想法和建议将不胜感激。谢谢。
答案 0 :(得分:1)
=IF(WeekDay<=5,
IF(AND(Hour_of_Day>=6,Hour_of_Day<14),"A",
IF(AND(Hour_of_Day>=14,Hour_of_Day<22),"B",
IF(AND(WeekDay=1,Hour_of_Day<6),"WN","C"))),
IF(AND(Hour_of_Day>=6,Hour_of_Day<18),"WD",
IF(AND(WeekDay=6,Hour_of_Day<6),"C","WN")))
&#13;
答案 1 :(得分:0)
$( ".datepicker" ).datepicker({
dateFormat: "yy-mm-dd",
defaultDate: +0,
onSelect:{your thing},
minDate: new Date(),
});
我更喜欢这样做,每件事都在jquery文档中。
jquery datepicker中的Min-Max属性。检查出来。