For more information about how to determine whether the start time is earlier than the end time, see ValidateBox in jquery easyui.
Okay! Directly Add code
Copy codeThe Code is as follows:
View content: By Time:
<Input class = "easyui-datetimebox" style = "width: 180px" id = "start2" value = "$ {startTime}">
<Span class = "newfont06"> to </span>
<Input class = "easyui-datetimebox" style = "width: 180px "id =" end2 "value =" $ {endTime} "validType =" md ['# start2'] ">
<Input name = "Submit4" type = "button" class = "right-button02" value = "query" onclick = "query2 ('$ {pid }'); "id =" query "/>
Copy codeThe Code is as follows:
<Script type = "text/javascript">
Var varify; // used for query and verification. Check whether the start time is earlier than the end time.
Function query2 (pid ){
If (varify ){
StartTime2 = $ ('# start2'). datetimebox ('getvalue ');
EndTime2 = $ ('# end2'). datetimebox ('getvalue ');
Window. location. href = "listPagingArticle? Pid = "+ pid +" & pageNumber = 1 & start = "+ startTime2 +" & end = "+ endTime2;
} Else {
$. Messager. alert ('Warning ', 'end time must be later than starttime', 'warning ');
}
}
$. Fn. datebox. defaults. formatter = function (date) {// time format conversion
Var y = date. getFullYear ();
Var m = fullnum (date. getMonth () + 1 );
Var d = fullnum (date. getDate ());
Return y + '-' + m + '-' + d;
};
Function fullnum (obj) {// for conversions in the format of less than 10 months, because the Timestamp conversion must be in the format of 2013-01-04
If (Number (obj) <10 ){
Return '0' + obj;
} Else {
Return obj;
}}
$. Extend ($. fn. validatebox. defaults. rules, {// The verification start time is earlier than the end time
Md :{
Validator: function (value, param ){
StartTime2 = $ (param [0]). datetimebox ('getvalue ');
Var d1 = $. fn. datebox. defaults. parser (startTime2 );
Var d2 = $. fn. datebox. defaults. parser (value );
Varify = d2> d1;
Return varify;
},
Message: 'The End Time must be later than the start time! '
}
})
</Script>