Advertisement
Guest User

Untitled

a guest
Feb 27th, 2016
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.45 KB | None | 0 0
  1. <%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" %>
  2.  
  3. <script runat="server">
  4.  
  5.  
  6.  
  7.  
  8. </script>
  9.  
  10. <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
  11. <form action ="#" method ="get" onsubmit="return CheckForm()">
  12. <center>
  13. <br />
  14. <br />
  15. <h1 style="text-decoration: underline; color: #FF9966; text-align: center;"><b>הירשם</b></h1>
  16.  
  17. <br />
  18. <br />
  19. <br />
  20.  
  21.  
  22.  
  23.  
  24.  
  25. <table id = "table" >
  26. <tr>
  27. <td id ="td1"></td>
  28. <td ><input type ="text" id ="username" name = "username" />שם משתמש</td>
  29. </tr>
  30.  
  31.  
  32. <tr>
  33. <td id = "td2"> </td>
  34. <td ><input type ="password" id = "password" name = "password"/> סיסמא</td>
  35. </tr>
  36.  
  37.  
  38. <tr>
  39. <td id = "td5"></td>
  40. <td ><input type ="password" id="asherpassword" /> אשר סיסמא</td>
  41. </tr>
  42.  
  43.  
  44. <tr>
  45. <td id = "td6"></td>
  46. <td><input type = "text" id ="id"/> תעודת זהות</td>
  47. </tr>
  48.  
  49.  
  50. <tr>
  51. <td id = "td3"></td>
  52. <td><input type ="text" id= "pnumber"/> מספר טלפון</td>
  53. </tr>
  54. <tr>
  55. <td id ="td4"></td>
  56. <td><input type ="text" id="fullname" /> שם מלא </td>
  57. </tr>
  58.  
  59.  
  60. <tr>
  61. <td id = "td10"></td>
  62. <td ><input type ="text" id = "email" />איימיל </td>
  63. </tr>
  64.  
  65.  
  66. <tr>
  67. <td id = "td7"></td>
  68. <td ><input type ="text" id = "adress"/> כתובת </td>
  69. </tr>
  70.  
  71. <tr>
  72. <td id = "td8"></td>
  73. <td dir ="rtl"> <input type ="radio" id ="male"/> נקבה <input type = "radio" id = "female" /> זכר</td>
  74. </tr>
  75.  
  76.  
  77. <tr>
  78. <td id = "td9"></td>
  79. <td dir ="rtl"><select id = "day">
  80.  
  81. <option>בחר יום</option>
  82. <option>1</option>
  83. <option>2</option>
  84. <option>3</option>
  85. <option>4</option>
  86. <option>5</option>
  87. <option>6</option>
  88. <option>7</option>
  89. <option>8</option>
  90. <option>9</option>
  91. <option>10</option>
  92. <option>11</option>
  93. <option>12</option>
  94. <option>13</option>
  95. <option>14</option>
  96. <option>15</option>
  97. <option>16</option>
  98. <option>17</option>
  99. <option>18</option>
  100. <option>19</option>
  101. <option>20</option>
  102. <option>21</option>
  103. <option>22</option>
  104. <option>23</option>
  105. <option>24</option>
  106. <option>25</option>
  107. <option>26</option>
  108. <option>27</option>
  109. <option>28</option>
  110. <option>29</option>
  111. <option>30</option>
  112. <option>31</option>
  113. </select>
  114.  
  115. <select id = "month">
  116. <option>בחר חודש</option>
  117. <option>1</option>
  118. <option>2</option>
  119. <option>3</option>
  120. <option>4</option>
  121. <option>5</option>
  122. <option>6</option>
  123. <option>7</option>
  124. <option>8</option>
  125. <option>9</option>
  126. <option>10</option>
  127. <option>11</option>
  128. <option>12</option>
  129.  
  130. </select>
  131. </td>
  132. </tr>
  133. </table>
  134.  
  135. <br />
  136. <br />
  137. <br />
  138. <br />
  139. <br />
  140. <br />
  141. <br />
  142. <br />
  143. <br />
  144. <br />
  145. <br />
  146. <br />
  147. <br />
  148. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type ="submit" value = "הרשמה" />
  149.  
  150.  
  151. </center>
  152. </form>
  153.  
  154.  
  155. <script type ="text/javascript">
  156.  
  157. function CheckForm() {
  158.  
  159. var a = Checkuserandpassword() ;
  160. var b = CheckPhonenumber();
  161. var c = CheckFullname();
  162. var d = CheckID();
  163. var e = Checkadress();
  164. var f = CheckGender();
  165. var g = CheckBorn();
  166. var h = Check();
  167.  
  168. return a, b, c, d, e, f, g, h;
  169.  
  170.  
  171. }
  172.  
  173.  
  174. function Checkuserandpassword() {
  175.  
  176. var username = document.getElementById("username").value;
  177. var password = document.getElementById("password").value;
  178. var asherpassword = document.getElementById("asherpassword").value;
  179. var bool1 = false;
  180. var bool2 = false;
  181. var bool3 = false;
  182. var bool4 = false;
  183. var bool5 = false;
  184. var bool6 = false;
  185. var bool7 = false;
  186. var bool8 = false;
  187. var bool9 = false;
  188.  
  189. if (username !="") // בודק האם כתוב משהו.
  190. bool1 = true;
  191. else
  192. document.getElementById("td1").innerHTML = "לא הוכנס שם משתמש!";
  193.  
  194.  
  195. if (username.length > 7) // בדוק האם האורך מספיק
  196. bool2 = true;
  197. else
  198. document.getElementById("td1").innerHTML = "שם המשתמש לא ארוך מספיק ";
  199.  
  200.  
  201. if (username = password) // האם שם מתשמש וסיסמא זהים
  202. document.getElementById("td2").innerHTML = "שם מתשמש וסיסמא זהים";
  203. else
  204. bool3 = true;
  205.  
  206. if (asherpassword == password) { // בודק האם סיסמא ואימות סיסמא זהים
  207. bool6 = true;
  208. }
  209. else {
  210. document.getElementById("td2").innerHTML = "שגיאה - סיסמא ואימות סיסמא אינם זהים";
  211. }
  212. }
  213.  
  214.  
  215. // ----------------------------------------------------------------------------------- מספר טלפון
  216.  
  217. function CheckPhonenumber() {
  218.  
  219. var phonenumber = document.getElementById("pnumber").value;
  220.  
  221. //string str = "blablabla";
  222.  
  223.  
  224. if (phonenumber.substring(1, 2) >= '0' && phonenumber.substring(4, phonenumber.length) <= '9') {
  225. bool4 = true;
  226. }
  227. else {
  228. document.getElementById("td3").innerHTML = "שגיאה - המספר מכיל תווים לא חוקיים"; // בודק האם המספר רק עם ספרות
  229. }
  230. if (phonenumber.charAt(3) != '-') {
  231. document.getElementById("td3").innerHTML = "שגיאה - המספר אינו מכיל תו מפריד"; // בודק האם המספר מכיל תו מפריד
  232. }
  233. if (phonenumber.charAt(0) != '0') {
  234. document.getElementById("td3").innerHTML = "שגיאה - הספרה הראשונה אינה 0"; // בודק האם הספרה הראשונה היא 0
  235. }
  236. }
  237. // ------------------------------------------------------------------------------------------------- שם פרטי ושם משפחה
  238.  
  239. function CheckFullname() {
  240.  
  241. var fullname = document.getElementById("fullname").value;
  242.  
  243.  
  244.  
  245.  
  246. }
  247.  
  248. // ----------------------------------------------------------------------------------------------------------- תעודת זהות
  249.  
  250.  
  251. function CheckID() {
  252.  
  253. var ID = document.getElementById("id").value;
  254.  
  255. if (ID.Length != 9) {
  256. document.getElementById("td6").innerHTML = "שגיאה - אורך תעודת זהות אינו תקין";
  257. }
  258.  
  259. if (ID.substring(0,ID.length) >= '0' && ID.substring(0,ID.length) <= '9') {
  260. bool7 = true;
  261. }
  262. else
  263. document.getElementById("td6").innerhtml = "שגיאה - תעודת הזהות מכילה תווים לא חוקיים";
  264.  
  265. }
  266.  
  267. // -------------------------------------------------------------------------------------------------------- כתובת
  268.  
  269. function Checkadress() {
  270.  
  271. var adress = document.getElementById("adress").value;
  272.  
  273. if (adress.substring(0, adress.length) >= 'א' && adress.substring(0, adress.length) <= 'ת') { // בודק האם כתובת בעברית
  274. bool5 = true;
  275. }
  276. else
  277. document.getElementById("td7").innerHTML = "שגיאה - תווים לא חוקיים בכתובת";
  278.  
  279.  
  280.  
  281. }
  282.  
  283. // ----------------------------------------------------------------------------------------------------------------- מין
  284. function CheckGender() {
  285.  
  286. var male = document.getElementById("male");
  287. var female = document.getElementById("female");
  288.  
  289. if (male.checked || male.checked) { // בודק האם נבחר מין
  290. bool8 = true;
  291. }
  292. else {
  293. document.getElementById("td8").innerHTML = "שגיאה - לא בחרת מין";
  294. }
  295. }
  296.  
  297. // ------------------------------------------------------------------------------------------------------------------------ תאריך לידה
  298.  
  299.  
  300. function CheckBorn() {
  301.  
  302. var day = document.getElementById("day");
  303. var month = document.getElementById("month");
  304.  
  305. if ((day.selectedIndex[0, day.length] != day.selectedIndex[0]) && (month.selectedIndex[0, month.length] != month.selectedIndex[0])) {
  306. bool9 = true;
  307. }
  308. else {
  309. document.getElementById("td9").innerHTML = "שגיאה - לא בחרת חודש או יום";
  310.  
  311. }
  312. }
  313.  
  314. function Check() {
  315.  
  316.  
  317. var counter = 0;
  318. var counter2 = 0;
  319. var email = document.getElementById("email").value;
  320.  
  321.  
  322. for (var i = 0; i < email.length; i++) {
  323.  
  324. if (email.charAt(i) = "@") {
  325.  
  326. counter++;
  327.  
  328. }
  329.  
  330.  
  331. }
  332.  
  333. if (counter == 0) {
  334.  
  335. document.getElementById("td10").innerHTML = "שגיאה חסר שטרודל";
  336.  
  337. }
  338. if (counter > 1) {
  339.  
  340. document.getElementById("td10").innerHTML = "שגיאה התו שטרודל מופיע יותר מפעם אחת";
  341. }
  342. for (var i = 0; i < email.length; i++) {
  343.  
  344. if (email.charAt(i) = ".") {
  345.  
  346. counter2++;
  347.  
  348. }
  349. }
  350.  
  351. if (counter2 == 0) {
  352.  
  353. document.getElementById("td10").innerHTML = "שגיאה חסר נקודה";
  354.  
  355. }
  356. if (counter2 > 1) {
  357.  
  358. document.getElementById("td10").innerHTML = "שגיאה התו נקודה מופיע יותר מפעם אחת";
  359. }
  360.  
  361. }
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369. </script>
  370. </asp:Content>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement