Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="pl">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title></title>
  6. <script>
  7. function hasslo()
  8. {
  9. var haslo=document.getElementById("haslo").value;
  10. var d=(haslo).length;
  11. if(haslo=="")
  12. {
  13. document.getElementById("napis").innerHTML='<span style="color:red">HASŁO JEST PUSTE </span>';
  14. }
  15. else
  16. {
  17. var a=0;
  18. for (i=0; i<d;i++)
  19. {
  20. if (isNaN(haslo.charAt(i))==false)
  21. a+=1;
  22. }
  23. if(d>6 && haslo.endsWith("ówka"))
  24. {
  25. document.getElementById("napis").innerHTML='<span style="color:green">HASŁO SPEŁNIA WYMAGANIA! </span>';
  26. }
  27. else
  28. {
  29. document.getElementById("napis").innerHTML='<span style="color:red">HASŁO NIE SPEŁNIA WYMAGAŃ! </span>';
  30. }
  31. }
  32. }
  33. </script>
  34. </head>
  35.  
  36. <body>
  37. <input id="haslo" type="text">
  38. <input onclick="hasslo()" type="button" value="Sprawdz">
  39. <div id="napis"></div>
  40. </body>
  41.  
  42. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement