Advertisement
Shavit

Form2

Dec 25th, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 4.02 KB | None | 0 0
  1. <!--Shavit Borisov-->
  2. <!--18.12.14-->
  3. <!--http://pastebin.com/rvJUfkWx-->
  4.  
  5. <!DOCTYPE html>
  6. <html style="direction: rtl">
  7.     <head>
  8.         <meta charset="UTF-8">
  9.         <style type="text/css">
  10.             #title {color: darkblue}
  11.             td {text-align: right}
  12.             label {background-color: steelblue; font-size: 20px; font-weight: bold}
  13.             #age {width: 3em}
  14.             .buttons {width: 120px}
  15.         </style>
  16.         <script type="text/javascript">
  17.             function checkStr(str) {
  18.                 var capital = false;
  19.                 var smaller = false;
  20.                 var digit = false;
  21.                
  22.                 for(var i = 0; i < str.length; i++) {
  23.                     var char = str.charAt(i);
  24.                    
  25.                     if(char >= '0' && char <= '9')
  26.                         digit = true;
  27.                     else if(char >= 'a' && char <= 'z')
  28.                         smaller = true;
  29.                     else if(char >= 'A' && char <= 'Z')
  30.                         capital = true;
  31.                 }
  32.                
  33.                 return (capital && smaller && digit);
  34.             }
  35.  
  36.             function checkBoth() {
  37.                 var pass1 = document.getElementById("pass");
  38.                 var pass2 = document.getElementById("passconfirm");
  39.                
  40.                 if(pass1.value.length < 5)
  41.                     pass1.setCustomValidity("Password must be at least 5 chars long!");
  42.                 else if(!checkStr(pass1.value))
  43.                     pass1.setCustomValidity("Password must contain 1 uppercase letter, 1 lowercase letter and 1 digit!");
  44.                 else if(pass1.value != pass2.value)
  45.                     pass1.setCustomValidity("Passwords don't macth!");
  46.                 else
  47.                     pass1.setCustomValidity("");
  48.             }
  49.  
  50.             function checkID() {
  51.                 var ID = document.getElementById("ID");
  52.                
  53.                 if(ID.value.length != 9)
  54.                     ID.setCustomValidity("Invalid!");
  55.                 else
  56.                     ID.setCustomValidity("");
  57.             }
  58.         </script>
  59.         <title>Form</title>
  60.     </head>
  61.     <body>
  62.         <h1 id="title">טופס רישום</h1>
  63.         <form action="mailto:shavitborisov@gmail.com" method="post" name="form1">
  64.             <table>
  65.                 <tr>
  66.                     <td><label for="fname">שם פרטי:</label></td>
  67.                     <td><input type="text" name="fname" id="fname" required="required"></td>
  68.                     <td><label for="nname">שם כינוי:</label></td>
  69.                     <td><input type="text" name="nname" id="nname" required="required"></td>
  70.                 </tr>
  71.                 <tr>
  72.                     <td><label for="lname">שם משפחה:</label></td>
  73.                     <td><input type="text" name="lname" id="lname" required="required"></td>
  74.                     <td><label for="pass">קוד גישה:</label></td>
  75.                     <td><input type="password" name="pass" id="pass" required="required" onchange="checkBoth()"></td>
  76.                 </tr>
  77.                 <tr>
  78.                     <td><label for="ID">תעודת זהות:</label></td>
  79.                     <td><input type="text" name="ID" id="ID" required="required" onchange="checkID()"></td>
  80.                     <td><label for="passconfirm">קוד גישה פעם נוספת:</label></td>
  81.                     <td><input type="password" name="passconfirm" id="passconfirm" required="required" onchange="checkBoth()"></td>
  82.                 </tr>
  83.                 <tr>
  84.                     <td><label for="age">גיל:</label></td>
  85.                     <td><input type="number" min="0" max="120" name="age" id="age" required="required"></td>
  86.                     <td><label for="class">כיתה:</label></td>
  87.                     <td><select name="class" id="class">
  88.                         <option value="10" selected="selected">כיתה י'</option>
  89.                         <option value="11">כיתה י"א</option>
  90.                         <option value="12">כיתה י"ב</option>
  91.                     </select></td>
  92.                 </tr>
  93.                 <tr>
  94.                     <td><label>מין:</label></td>
  95.                     <td>
  96.                         <label for="male">זכר:</label><input type="radio" value="male" name="sex" id="male" required="required"/>
  97.                         <label for="female">נקבה:</label><input type="radio" value="female" name="sex" id="female" required="required"/>
  98.                     </td>
  99.                     <td><label for="notes">הערות:</label></td>
  100.                     <td><textarea rows="4" cols="25" name="notes" id="notes"></textarea></td>
  101.                 </tr>
  102.                 <tr>
  103.                     <td><label for="email">אימייל:</label></td>
  104.                     <td>
  105.                         <input type="email" size="30" name="email" id="email" required="required">
  106.                     </td>
  107.                 </tr>
  108.                 <tr>
  109.                     <td></td>
  110.                     <td>
  111.                         <input class="buttons" type="submit" name="submit" value="שלח">
  112.                         <input class="buttons" type="reset" name="clear" value="נקה">
  113.                     </td>
  114.                 </tr>  
  115.             </table>
  116.         </form>
  117.     </body>
  118. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement