Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- </head>
- <script type="text/javascript">
- function auswerten()
- {
- var date = document.getElementById("Eingabe").value;
- var day = date.substring(0,2);
- var month = date.substring(3,5);
- var year = date.substring(6,10);
- if (!isNaN(day) && !isNaN(month) && !isNaN(year) && date.length >= 10 && date.substring(2,3) == "." && date.substring(5,6) == ".")
- {
- if ((day < 32 && day > 0) && (month < 13 && month > 0) && (year > 1900))
- {
- alert(date);
- document.getElementById("Eingabe").focus();
- }
- else
- {
- alert("Die Eingabe entspricht nicht den Normen!");
- document.getElementById("Eingabe").focus();
- }
- }
- else
- {
- alert("Das Eingegebene ist kein Datum!");
- document.getElementById("Eingabe").focus();
- }
- }
- </script>
- <body>
- <input name="Eingabe" id="Eingabe" type="text" placeholder="dd.mm.yyyy" />
- <input type="button" value="Abschicken" onclick="auswerten()" />
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement