I am trying force the user to type in 4 digits for the year. Below is my code. I appreciate your help.
function validateBirth(fld, errMsg)
{
var stDate = new Date(fld.value);
today=new Date();
var oneday=10006060*24;
var age = Math.ceil((stDate.getTime()-today.getTime())/(oneday));
if (stDate == “NaN”)
{
alert("Please enter a valid date for " + errMsg + “.”);
fld.focus();
return false;
}
if (age > 0)
{
alert (“Date is in the future”);
return false;
}//endif
return true;
}//endfunction validateBirthdate