<! Doctype HTML public "-// W3C // dtd html 4.0 transitional // en" >
< Html >
< Head >
< Title > New Document </ Title >
< Meta Name = "Generator" Content = "Editplus" >
< Meta Name = "Author" Content = "" >
< Meta Name = "Keywords" Content = "" >
< Meta Name = "Description" Content = "" >
< Script Type = "Text/JavaScript" SRC = "Jquery-1.4.2.js" > </ Script >
< Script Type = "Text/JavaScript" SRC = "Jquery. Validate. js" > </ Script >
< Script Language = "JavaScript" >
<! --
Jquery ( Function (){
Jquery. validator. Methods. comparedate = Function (Value, element, Param ){
// VaR startdate = jquery (PARAM). Val () + ": 00"; supplemented in yyyy-mm-dd hh: mm: SS format
// Value = value + ": 00 ";
VaR Startdate = Jquery (PARAM). Val ();
VaR Date1 = New Date (date. parse (startdate. Replace ( " - " , " / " )));
VaR Date2 = New Date (date. parse (value. Replace ( " - " , " / " )));
Return Date1 < Date2;
};
Jquery ( " # Form1 " ). Validate ({
Focusinvalid: False ,
Rules :{
" Timestart " :{
Required: True
},
" Timeend " :{
Required: True ,
Comparedate: " # Timestart "
}
},
Messages :{
" Timestart " :{
Required: " Start time cannot be blank "
},
" Timeend " :{
Required: " End Time cannot be blank " ,
Comparedate: " The end date must be later than the start date! "
}
}
});
});
// -->
</ Script >
</ Head >
< Body >
< Form ID = "Form1" Name = "Form1" Method = "Post" Action = "Demo.html" >
< P > Timestart:
< Input Name = "Timestart" Type = "Text" ID = "Timestart" Value = "10:00:00" > Yyyy-mm-dd hh: mm: SS
</ P >
< P > Timeend:
< Input Name = "Timeend" Type = "Text" ID = "Timeend" Value = "9:00:00" > Yyyy-mm-dd hh: mm: SS
</ P >
< P >
< Input Type = "Submit" Name = "Submit" Value = "Submit" >
</ P >
</ Form >
</ Body >
</ Html >