Created
August 14, 2012 16:52
-
-
Save scan/3350816 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript"> | |
function check() { | |
var day = parseInt(document.getElementById("iDay").value); | |
var month = parseInt(document.getElementById("iMonth").value) - 1; | |
var year = parseInt(document.getElementById("iYear").value); | |
console.log([day,month,year]); | |
var date = new Date(year, month, day); | |
console.log(date); | |
if (day !== date.getDate() || month !== date.getMonth() || year !== (1900 + date.getYear())) { | |
window.alert("die eingabe ist inkorrekt"); | |
// return false; | |
} else { | |
// return true; | |
window.alert("alles super"); | |
} | |
} | |
</script> | |
</head> | |
<body> | |
<form onsubmit="check()" action="#"> | |
<input type="text" id="iDay" /> | |
<input type="text" id="iMonth" /> | |
<input type="text" id="iYear" /> | |
<input type="submit" /> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment