-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathsignup.html
85 lines (85 loc) · 2.41 KB
/
signup.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sellit Sign Up Page</title>
</head>
<body>
<h1>STUDENT REGISTRATION FORM</h1>
<form name="register" onsubmit="return validateForm()" action="https://www.google.com" method="POST">
<ol>
<li>
<label>FIRST NAME</label>
<input type="text" name="fname" required>
</li>
<li> <label>DATE OF BIRTH</label>
<label>LAST NAME</label>
<input type="text" name="lname" required>
</li>
<li>
<label>YOUR AGE</label>
<input type="number" name="age">
</li>
<li>
<label>EMAIL ID</label>
<input type="email" name="email">
</li>
<li>
<label>DATE OF BIRTH</label>
<input type="date" name="date">
</li>
<li>
<label>GENDER</label><br>
<input type="radio" value="Male" name="gender" id="male" checked><label for="male">Male</label><br>
<input type="radio" value="Female" name="gender" id="female"><label for="female">Female</label><br>
<input type="radio" value="Other" name="gender" id="other"><label for="other">Other</label><br>
</li>
<li>
<label>MOBILE NUMBER</label>
<input type="tel" name="mobile">
</li>
<li>
<label>ENTER YOUR ADDRESS</label><br>
<textarea required style="background-color: LightBlue;" name="address"></textarea>
</li>
</ol>
<input type="submit" value="REGISTRATION">
</form>
<script>
function validateForm(){
let form = document.forms.register;
if (!isNaN(form.fname.value)) {
alert("First Name cant be blank or Number");
return false;
}
if (!isNaN(form.fname.value)) {
alert("Last name cant be blank or a number");
return false;
}
if (form.age.value<18 || form.age.value>=100) {
alert("Age should be greater 18 and less than 100");
return false;
}
if (!form.email.value.endsWith("@gmail.com")) {
alert("Should be gmail");
return false;
}
age = Math.abs((new Date(Date.now() - (new Date(form.date.value)).getTime()).getUTCFullYear()) - 1970);
if (age<=18) {
alert("DOB says age less than 18");
return false;
}
if (!isNAN(form.col_name.value)) {
alert("College Name shouldnt be number");
return false;
}
if (form.mobile.value.length != 10 || !["9","8","7","6"].includes(form.mobile.value[0])) {
alert("Mobile Number should 10 digits and start with 9,8,7 or 6");
return false;
}
}
</script>
</body>
</html>