-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.html
64 lines (61 loc) · 2.27 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
<!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>Signup Page</title>
</head>
<body align="center">
<h1>CREATE YOUR ACCOUNT</h1>
<table cellspacing="2" align="center" cellpadding="8" border="0">
<tr>
<td>Name</td>
<td><input type="text" placeholder="Enter your name" id="n1" /></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" placeholder="Enter your email id" id="e1" /></td>
</tr>
<tr>
<td>Set Password</td>
<td><input type="password" placeholder="Set your password" id="p1" /></td>
</tr>
<tr>
<td>Confirm Password</td>
<td><input type="password" placeholder="Confirm your password" id="p2" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Create" onclick="create_account()" /></td>
</tr>
</table>
<!-- Javascript -->
<script type="text/javascript">
function create_account() {
var n = document.getElementById("n1").value;
var e = document.getElementById("e1").value;
var p = document.getElementById("p1").value;
var cp = document.getElementById("p2").value;
var letters = /^[A-Za-z]+$/;
var email_val = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2, 4})+$/;
if (n == "" || e == "" || p == "" || cp == "") {
alert("Enter each details correctly");
} else if (!letters.test(n)) {
alert("Name is incorrect, must contain alphabets");
} else if (!email_val.test(e)) {
alert("Invalid email format, please enter valid email id");
} else if (p != cp) {
alert("Password not matching");
} else if (p.length > 12) {
alert("Password maximum length is 12");
} else if (p.length < 6) {
alert("Password minimum length is 6");
} else {
alert("Your account has been created succesfully ... redirecting to JavaTpoint.com");
window.location = "https://www.javatpoint.com";
}
}
</script>
</body>
</html>