我已经汇编了下面的代码,它在大多数情况下都有效。什么是不工作的是函数的前两行,涉及最小/最大日期和动画。其他一切都很完美。有什么想法吗?
<script type="text/javascript">
/* jQuery ready function. Specify a function to execute when the DOM is fully loaded. */
$(document).ready(
/* This is the function that will get executed after the DOM is fully loaded */
function () {
$("#datepicker").datepicker('option', {minDate: 0, maxDate: "+1Y"});
$("#datepicker").datepicker('option', {showAnim: 'drop'});
$("#datepicker").datepicker('option', {changeMonth: false})
$("#datepicker").datepicker('option', {changeYear: false})
$("#datepicker").datepicker({ dateFormat: "DD, MM d, yy" }).val()
$("#datepicker").datepicker('option', {altField: "#altDate"})
$("#datepicker").datepicker('option', {altFormat: "yy-mm-dd"})
}
);
</script>
已解决:通过将两条顶行移到底部,可以解决问题。
<script type="text/javascript">
/* jQuery ready function. Specify a function to execute when the DOM is fully loaded. */
$(document).ready(
/* This is the function that will get executed after the DOM is fully loaded */
function () {
$("#datepicker").datepicker('option', {changeMonth: false})
$("#datepicker").datepicker('option', {changeYear: false})
$("#datepicker").datepicker({ dateFormat: "DD, MM d, yy" }).val()
$("#datepicker").datepicker('option', {altField: "#altDate"})
$("#datepicker").datepicker('option', {altFormat: "yy-mm-dd"})
$("#datepicker").datepicker('option', {minDate: 0, maxDate: "+1Y"});
$("#datepicker").datepicker('option', {showAnim: 'drop'});
}
);
</script>