Advertisement
Guest User

Untitled

a guest
May 27th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. <html>
  2. <head>
  3. </head>
  4. <script type="text/javascript">
  5. function auswerten()
  6. {
  7. var date = document.getElementById("Eingabe").value;
  8. var day = date.substring(0,2);
  9. var month = date.substring(3,5);
  10. var year = date.substring(6,10);
  11. if (!isNaN(day) && !isNaN(month) && !isNaN(year) && date.length >= 10 && date.substring(2,3) == "." && date.substring(5,6) == ".")
  12. {
  13. if ((day < 32 && day > 0) && (month < 13 && month > 0) && (year > 1900))
  14. {
  15. alert(date);
  16. document.getElementById("Eingabe").focus();
  17. }
  18. else
  19. {
  20. alert("Die Eingabe entspricht nicht den Normen!");
  21. document.getElementById("Eingabe").focus();
  22. }
  23. }
  24. else
  25. {
  26. alert("Das Eingegebene ist kein Datum!");
  27. document.getElementById("Eingabe").focus();
  28. }
  29. }
  30. </script>
  31. <body>
  32. <input name="Eingabe" id="Eingabe" type="text" placeholder="dd.mm.yyyy" />
  33. <input type="button" value="Abschicken" onclick="auswerten()" />
  34. </body>
  35. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement