$("#s_shipDate_from").datepicker({
dateFormat : "yy-mm-dd",
showButtonPanel: false,
showOn: "button",
buttonImage: "images/Cal.gif",
buttonImageOnly: true,
onSelect: function (dateText, inst) {
if($('#s_shipDate_to').val()!="")
{
var fromDate = new Date(dateText);
var toDate = new Date($('#s_shipDate_to').val());
$('#s_shipDate_to').datepicker("option", 'minDate', fromDate);
if(toDate<fromDate)
{
alert("'TO' date must be more than 'FROM' date.");
$('#s_shipDate_to').datepicker("setDate", fromDate);
}
}
}
})
$("#s_shipDate_to").datepicker({
dateFormat : "yy-mm-dd",
showButtonPanel: false,
showOn: "button",
buttonImage: "images/Cal.gif",
buttonImageOnly: true,
beforeShow : function (input, inst) {
if($('#s_shipDate_from').val()!="")
{
var fromDate = new Date($('#s_shipDate_from').val());
$('#s_shipDate_to').datepicker("option", 'minDate', fromDate);
}
},
onSelect: function (dateText, inst) {
if($('#s_shipDate_from').val()!="")
{
var fromDate = new Date($('#s_shipDate_from').val());
var toDate = new Date(dateText);
if(toDate<fromDate)
{
alert("'TO' date must be more than 'FROM' date.");
$('#s_shipDate_to').datepicker("setDate", fromDate);
}
}
}
})
我有From
和To
日期字段,使用jquery-ui datepicker。我编写了上面的代码,以便To
日期不能超过From
日期,并且它在FF / chrome中运行良好,但在IE(8)中不起作用。有什么想法吗?
答案 0 :(得分:-1)
检查你的
<script type="text/javascript"></script>
标记如果它在“text / javascript”之后包含空格IE将不会运行脚本