//判断起始日期与结束日期大小
function ckdate() {
var endtime = $('#txtStorageTimeEnd').val();
var starttime = $('#txtStorageTimeStart').val();
var start = new Date(starttime.replace("-", "/").replace("-", "/"));
var end = new Date(endtime.replace("-", "/").replace("-", "/"));
if (end < start) {
alert('结束日期不能小于开始日期!');
return false;
}
else {
return true;
}
function ckdate() {
var endtime = $('#txtStorageTimeEnd').val();
var starttime = $('#txtStorageTimeStart').val();
var start = new Date(starttime.replace("-", "/").replace("-", "/"));
var end = new Date(endtime.replace("-", "/").replace("-", "/"));
if (end < start) {
alert('结束日期不能小于开始日期!');
return false;
}
else {
return true;
}
}
<asp:TextBox ID="txtStorageTimeStart" runat="server" οnclick="setday(this,false)" ></asp:TextBox>
到
<asp:TextBox ID="txtStorageTimeEnd" runat="server" οnclick="setday(this,false)" ></asp:TextBox>
<asp:Button ID="btnSearch" runat="server" Text="查询" οnclick="btnSearch_Click" OnClientClick="ckdate()" />