SHARE
TWEET

Registration 28/01/2016

a guest Jan 28th, 2016 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <head>
  3. <title>
  4. REGISTRATION
  5. </title>
  6. <script>
  7. function a(user)
  8. {
  9.     var flag = 0;
  10.     for( var i = 0; i < user.length; i++)
  11. {
  12.     if((user.charAt(i)<'a' || user.charAt(i)> 'z')
  13.     &&(user.charAt(i)<'A' || user.charAt(i)> 'Z'))
  14. {
  15.     flag++;
  16. }
  17. }
  18. if (flag == 0)
  19. return true ;
  20. else
  21. return false ;
  22. }
  23. function validation()
  24. {
  25. var pesan = document.getElementById("pesan");
  26. var user = document.getElementById("username").value;
  27. var password = document.getElementById("password").value;
  28. var cpass = document.getElementById("cpass").value;
  29. var email = document.getElementById("email").value;
  30. var day = document.getElementById("day").value;
  31. var month = document.getElementById("month").value;
  32. var year = document.getElementById("year").value;
  33. if (user == "")
  34. {
  35. pesan.innerHTML = "Isilah username anda!";
  36. }
  37. else if (a(user) == false)
  38. {
  39. pesan.innerHTML = "Username harus terdiri dari huruf bukan nomor atau simbol!";
  40. }
  41. //panjang password
  42. else if (password.length <= 10)
  43. {
  44. pesan.innerHTML = "Password harus lebih dari 10 digit!";
  45. }
  46. //Email
  47. else if(email.indexOf("@") == -1 || email.indexOf(".") == -1)
  48. {
  49. pesan.innerHTML = "Email belum terisi dengan lengkap!";
  50. }
  51. else if(email.indexOf("@") == 0 || email.indexOf("@") == email.length -1)
  52. {
  53. pesan.innerHTML = "Sebelum dan sesudah '@' harus ada kata!";
  54. }
  55. else if(email.indexOf(".") == 0 || email.indexOf(".") == email.length -1)
  56. {
  57. pesan.innerHTML = "Sebelum dan sesudah '.' harus ada kata!";
  58. }
  59. else if(email.indexOf(".") - email.indexOf("@") == 1)
  60. {
  61. pesan.innerHTML = "Ada kesalahan pada email anda!";
  62. }
  63. else if(email.indexOf(".") < email.indexOf("@"))
  64. {
  65. pesan.innerHTML = "Titik harus setelah '@'!";
  66. }
  67. else if (email.length >= 20)
  68. {
  69. pesan.innerHTML = "Email harus kurang dari 20 digit!";
  70. }
  71. //end of email
  72. else if (day == 0)
  73. {
  74. pesan.innerHTML = "Isilah kolom day";
  75. }
  76. else if (month == 0)
  77. {
  78. pesan.innerHTML = "Isilah kolom month";
  79. }
  80. else if (year == 0)
  81. {
  82. pesan.innerHTML = "Isilah kolom year";
  83. }
  84. //start confirm password
  85. else if (password != cpass)
  86. {
  87. pesan.innerHTML = "PASSWORD HARUS SAMA!";
  88. }
  89. else
  90. {
  91. pesan.innerHTML = "Sukses";
  92. }
  93. }
  94. </script>
  95. </head>
  96. <body>
  97. <table border="1">
  98. <tr>
  99. <td>
  100. <label for="username">Username</label>
  101. </td>
  102. <td>:</td>
  103. <td><input type="text" name="username" id="username"></input></td>
  104. </tr>
  105. <tr>
  106. <td>
  107. <label for="username">Email</label>
  108. </td>
  109. <td>:</td>
  110. <td><input type="text" name="E-Mail" id="email" maxlength="20"></input></td>
  111. </tr>
  112. <tr>
  113. <td>Birth Date</td>
  114. <td>:</td>
  115. <td>
  116. <select name="day" id="day">
  117. <option value="0">Day</option>
  118. <script>
  119. for(var i= 1; i <= 31; i++)
  120. document.writeln('<option value=\"+i+"\>"+i+"</option>')
  121. </script></select>
  122. <select name="month" id="month">
  123. <option value="0">Month</option>
  124. <script>
  125. for(var i= 1; i <= 12; i++)
  126. document.writeln('<option value=\"+i+"\>"+i+"</option>')
  127. </script></select>
  128. <select name="year" id="year">
  129. <option value="0">Year</option>
  130. <script>
  131. for(var i= (new Date()).getFullYear() - 100 ; i <= (new Date()).getFullYear() ; i++)
  132. document.writeln('<option value=\"+i+"\>"+i+"</option>')
  133. </script></select>
  134. </td>
  135. </tr>
  136. <tr>
  137. <td>
  138. <label for="password">Password</label>
  139. </td>
  140. <td>:</td>
  141. <td><input type="password" name="password" id="password"></input></td>
  142. </tr>
  143. <tr>
  144. <td>
  145. <label for="cpass">Confirm Password</label>
  146. </td>
  147. <td>:</td>
  148. <td><input type="password" name="Confirm Password" id="cpass"></input></td>
  149. </tr>
  150. <tr>
  151. <td>
  152. <div id="pesan" style="color:blue;"></div>
  153. </td>
  154. </tr>
  155. <tr>
  156. <td>
  157. <input type="button" value="Register" onclick="validation()"/>
  158. </td>
  159. </tr>
  160. </table>
  161. </body>
  162. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top