我有一个在Firefox中工作正常的日期选择器,但在Internet Explorer(10)中,minDate,maxDate和beforeShowday不起作用。谁有同样的问题?你的解决方案是什么?
myJS.js
$(document).ready(function () {
$("#datepicker").datepicker({
monthNames: ["Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"],
dayNamesMin: ["Sön", "Mån", "Tis", "Ons", "Tors", "Fre", "Lör"],
dateFormat: "yy-mm-dd",
firstDay: 1,
selectWeek: true,
beforeShowDay: $.datepicker.noWeekends,
maxDate: "+30D",
minDate: 0,
closeOnSelect: false
});
});
asp.net
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/base/jquery-ui.css" />
<asp:TextBox ID="datepicker" runat="server" CssClass="textbox" ReadOnly="False" AutoPostBack="True" Width="200px" OnTextChanged="datepicker_TextChanged" Height="22px"></asp:TextBox>
答案 0 :(得分:2)
您不应使用文本来设置最大或最小日期。每个浏览器都以不同的方式解释它们。
尝试做:
var date = new Date(); date.setDate(date.getDate()+ 30);
minDate:date ,maxDate:-1
答案 1 :(得分:-1)
$(document).ready(function () {
$("#datepicker").datepicker({
monthNames: ["Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"],
dayNamesMin: ["Sön", "Mån", "Tis", "Ons", "Tors", "Fre", "Lör"],
dateFormat: "yy-mm-dd",
firstDay: 1,
selectWeek: true,
beforeShowDay: $.datepicker.noWeekends,
maxDate: "+30D",
yearStart:1900,
closeOnSelect: false
});
});