【发布时间】:2013-05-13 09:27:00
【问题描述】:
我有一个 html 格式的 Jquery 日历。它显示从和到日期。以下是我的代码:
html头部代码:
<link rel="stylesheet" href="jquery/jquery.ui.all.css">
<script src="jquery/jquery-1.9.1.js"></script>
<script src="jquery/jquery.ui.core.js"></script>
<script src="jquery/jquery.ui.widget.js"></script>
<script src="jquery/jquery.ui.datepicker.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
$( "#from" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 1,
onClose: function( selectedDate ) {
$( "#to" ).datepicker( "option", "minDate", selectedDate );
}
});
$( "#to" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 1,
onClose: function( selectedDate ) {
$( "#from" ).datepicker( "option", "maxDate", selectedDate );
}
});
});
</script>
html正文代码:
<label for="from">From</label>
<input type="text" id="from" name="from" class="tr"/>
<label for="to">to</label>
<input type="text" id="to" name="to" class="tr"/>
嗯,它工作正常。但是是否可以禁用过去一个月的归档名称 from ?我只是希望用户不能选择上个月到 from 字段。
日历现在的工作方式: 如果用户选择从日期,即 18-05-2013 则 To date 从 18-05-2013 开始,如果它的 20-08-2013 则 to date 从 20-08-2013 开始。
【问题讨论】:
-
在旁注中看看 Kalendae:github.com/ChiperSoft/Kalendae
-
@fmsf 实际上我是 jquery 的新手,这是我的学习时间。