$("#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);
}
}
}
})
我用jquery- ui datepicker 将 < code> from 和 to
datefields 编为 < code> to datefields。 我写了上述代码, 以便 to
date > dates不能超过 from
date > dates, 它在FF/chrome 中工作得很好, 但在 IE( 8) 中工作不了, 有什么想法吗?