$ ("#startDate"). Val (); For string date format that is Yyyy-mm-ddfunction checktime () { var sdate=$ ("#startDate"). Val (); var edate=$ ("#endDate"). Val (); var startdate = new date (Sdate.replace ("-", ",")). GetTime () ; Var enddate = new date (Edate.replace ("-", ",")). GetTime () ; if ( startDate > endDate ) { alert ("The start time cannot be greater than the end time!") "); $ (" #endDate "). val ("") } retUrn true;} Function checknum (obj) { //Check for non-numeric values if (IsNaN (obj.value)) { alert ("Please fill in numbers!"); obj.value = ""; } if (obj != null) { //check for two-bit if after decimal point (Obj.value.toString (). Split ("."). Length > 1 && obj.value.tostring (). Split (".") [1].length > 2) { alert ("No more than two digits after the decimal point!") "); obj.value = "" ; } } } function checkisnan (obj) { //Check if it is a non-numeric value if (IsNaN (Obj.value)) { alert (" Please fill in the numbers! "); obj.value = ""; } }
This article is from the "Green Years" blog, be sure to keep this source http://alex233.blog.51cto.com/8904951/1758522
About JS page time judgment, and some miscellaneous