//Verification of date (yyyy-mm-dd)
function CheckDate(strDate, i, dataValue) {
var reg = /^(/d{4})([-])(/ d{2})([-])(/d{2})/;
if (!reg.test(strDate)) {
jAlert("Date format of "i" row "dataValue" Incorrect!/nThe correct format is: 2007-01-01", "prompt information");
. var year = ss[0];
var month = ss[1];
var date = ss[2];
if (!checkYear(year, i)) {
return false;
}
if (!checkMonth(month, i,dataValue)) {
return false;
}
if (!checkDate(year, month, date, i,dataValue)) {
return false;
}
return true;
}
//Year judgment
function checkYear(year, i,dataValue) {
if (isNaN(parseInt(year ))) {
jAlert("The year of " dataValue " in row "i" is incorrect, please re-enter!", "Prompt message");
return false;
}
else if (parseInt(year) < 1900 || parseInt(year) > 2100) {
jAlert("The year of "dataValue" in row "i" should be between 1900-2100!", "Prompt message" );
return false; {
if (isNaN(parseInt(month))) {
jAlert("The month of the "i" row "dataValue" is incorrect, please re-enter!", "Prompt message");
return false;
}
if (month.substring(0, 1) == 0) {
if (parseInt(month.substring(1, 2)) < 1) {
jAlert ("The month of "i" row "dataValue" should be between 1-12!", "Prompt message");
; month) < 1 || parseInt(month) > 12) {
jAlert("The month of "i" row "dataValue" should be between 1-12!", "Prompt message");
return false;
} else {
return true; > var daysOfMonth = CalDays(parseInt(year), parseInt(month));
if (isNaN(parseInt(date))) {
jAlert("The date input for the "i"th row "dataValue" is incorrect Please re -enter! "," Note information ");
Return false;
}
Else If (Dateint (Date) & LT; 0 || PARSEINT (Date) & GT; Daysofmonth) {
jAlert("The date of the " i "th" row " dataValue " should be between 1-" daysOfMonth "!", "prompt information"); true;
}
}
function CalDays(year, month) {
var date = new Date(year, month, 0);
return date.getDate();
}
function isLeapYear(year) {
if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
return true;
} else {
return false;