Concordo con br1...
codice:
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Esempio</title>
<script type="text/javascript">
function checkDate (sToBeParsed) {
// yyyy-mm-dd
var aDate = sToBeParsed.split("-");
for (var nIdx = 0; nIdx < aDate.length; aDate[nIdx] = parseFloat(aDate[nIdx++]));
var
oParsedDate = new Date(aDate[0], aDate[1] - 1, aDate[2]),
bIsValid = /^\d{4}\-\d{2}\-\d{2}$/.test(sToBeParsed) && !isNaN(oParsedDate.getTime()) && aDate[0] === oParsedDate.getFullYear() && aDate[1] === oParsedDate.getMonth() + 1 && aDate[2] === oParsedDate.getDate();
if (!bIsValid) { alert("Inserire una data in formato \"aaaa-mm-gg\"."); }
return bIsValid;
}
</script>
</head>
<body>
<form name="tuoForm" onsubmit="return checkDate(this.nascita.value);">
Inserisci la tua data di nascita: <input type="text" name="nascita" /></p>
<input type="submit" value="Invia" />
</form>
</body>
</html>