0
$("#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);
                }
            }
        }
    })

我有日期字段FromTo使用 jquery-ui datepicker。我编写了上面的代码,因此To日期不能超过From日期,它在 FF/chrome 中效果很好,但在 IE(8) 中不起作用。有任何想法吗?

4

1 回答 1

-1

检查你的

<script type="text/javascript"></script> 

如果它在“text/javascript”之后包含空格,则标记 IE 将不会运行脚本

于 2012-05-25T07:54:44.570 回答