Advertisement
Guest User

Untitled

a guest
Feb 1st, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. msg= "";
  2. var counter=0;
  3. Firstname = document.rishum.Firstname.value;
  4. if (Firstname.length == 0)
  5. {
  6. msg = msg + "חסר שם פרטי \n";
  7. }
  8. for (i=0; i<Firstname.length; i++)
  9. {
  10. if (Firstname.charAt(i)<'a' || Firstname.charAt(i)>'z')
  11. {
  12. counter++;
  13. }
  14. }
  15. if(counter>0)
  16. msg=msg+"שם פרטי צריך לכלול רק אותיות \n";
  17. counter=0;
  18. Lastname = document.rishum.Lastname.value;
  19. if (Lastname.length == 0)
  20. {
  21. msg = msg + "חסר שם משפחה \n";
  22. }
  23. for (i=0; i<Lastname.length; i++)
  24. {
  25. if (Lastname.charAt(i)<'a' || Lastname.charAt(i)>'z')
  26. counter++;
  27. }
  28. if (counter>0)
  29. msg=msg+"שם משפחה צריך לכלול רק אותיות \n";
  30. counter=0;
  31. Username = document.rishum.Username.value;
  32. for (i=0; i<Username.length; i++)
  33. {
  34. if (Username.charAt(i)==' ')
  35. {
  36. counter++;
  37. }
  38. }
  39. if (counter>0)
  40. msg=msg+"שם משתמש לא יכול לכלול רווח \n";
  41. counter=0;
  42. Password = document.rishum.Password.value;
  43. ConfirmPassword = document.rishum.ConfirmPassword.value;
  44. if (Password.length<6)
  45. msg = msg + "סיסמה חייבת לכלול לפחות 6 תווים \n";
  46.  
  47. if (Password != ConfirmPassword)
  48. msg = msg + "סיסמאות לא תואמות \n";
  49.  
  50.  
  51. Age = document.rishum.Age.value;
  52. for (i=0; i<Age.length; i++)
  53. {
  54. if (Age.charAt(i)<'0' || Age.charAt(i)>'9')
  55. counter++;
  56. }
  57. if(counter>0)
  58. msg=msg+"גיל צריך לכלול רק מספרים \n";
  59. counter=0;
  60. if (msg.length==0)
  61. return true;
  62. else
  63. alert("בטופס קיימות הבעיות הבאות:"+" "+ msg);
  64. return false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement