这个函数在IE无效,在CHROME可正常执行哪错了。求教
function orderDateOnchange(obj) { var Now = new Date(); try { var start = $('#StartDate'); var end = $('#EndDate'); if (new Date(start.val()) > new Date(end.val())) { alert('<asp:Literal runat="server" Text="<%$ Resources:jsMsgDateError %>" />'); //問卷查詢區間,不可大於起始日期 obj.val(!confirmDateTime(obj, false)); } } catch (e) { obj.value = Now.getFullYear() + "/" + PadLeft(Now.getMonth() + 1, '0', 2) + "/" + PadLeft(Now.getDate(), '0', 2) + " " + PadLeft(Now.getHours(), '0', 2) + ":" + PadLeft(Now.getMinutes(), '0', 2); } }
在这里调用
<input style="width: 120px" id="StartDate" runat="server" name="StartDate" type="text" onchange="orderDateOnchange(this)" onblur="checkdate()" />