Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1.  
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <meta charset="utf-8">
  6. <script type="text/javascript">
  7. function sprawdz() {
  8. var formularz=document.getElementById("f");
  9.  
  10. wzory= {
  11. 'nazwisko': /^[A-Z]{1}[a-ząćęłńśźżó]+[\s]{1} [A-Z]{1}[a-ząćęłńśźżó]+$/,
  12. 'nip': /^[0-9]{3}-[0-9]{3}-[0-9]{2}-[0-9]{2}$/
  13. }
  14. //walidacja pol formularza ;P
  15. if(formularz['nazwisko'])
  16. {
  17. if(wzory['nazwisko'].test(formularz['nazwisko'].value))
  18. {
  19. formularz['nazwisko'].stylebackgroundColor="";
  20.  
  21. }
  22. else
  23. {
  24. alert("wprowadziłeś błędne dane debilu pierdolony!");
  25. formularz['nazwisko'].stylebackgroundColor="red";
  26. return false;
  27.  
  28. }
  29. }
  30. if(formularz['nip'])
  31. {
  32. if(wzory['nip'].test(formularz['nip'].value))
  33. {
  34. formularz['nip'].stylebackgroundColor="";
  35.  
  36. }
  37. else
  38. {
  39. alert("wprowadziłeś błędne dane debilu pierdolony!");
  40. formularz['nip'].stylebackgroundColor="red";
  41. return false;
  42.  
  43. }
  44. }
  45. }
  46. alert("Pola sa git!")
  47. return true;
  48.  
  49. </script>
  50.  
  51. </head>
  52. <body>
  53. <form action="mailto:gnomekxd11@gmail.com" method="post" enctype="text/plain" id="f" onsubmit="return sprawdz();">
  54. <h1>DANE OSOBOWEeeijeoiwqjewqe</h1>
  55. Imie i nazwisko:
  56. <input type="text" id="nazwisko" /><br><br>
  57. NIP:
  58. <input type="text" id="nip"><br><br>
  59. <input type="submit" id="wyslij">
  60. </form>
  61. </body>
  62. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement