Repository navigation
Expand file tree
/
Copy pathsignup.html
More file actions
56 lines (52 loc) · 1.86 KB
/
Copy pathsignup.html
File metadata and controls
56 lines (52 loc) · 1.86 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Signup | TM Digital Tech</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<center>
<div class="form-container">
<h2>Signup</h2>
<form id="signupForm" method="POST">
<input type="text" id="signupName" placeholder="Full Name" required>
<input type="email" id="signupEmail" placeholder="Email" required>
<input type="password" id="signupPassword" placeholder="Password" required>
<input type="password" id="signupConfirm" placeholder="Confirm Password" required>
<button type="submit">Signup</button>
<p class="redirect-text">Already have an account? <a href="login.html">Login</a></p>
</form>
<a href="index.html" class="back-home">← Back to Home</a>
</div>
</center>
<script>
document.getElementById("signupForm").addEventListener("submit", function(e) {
e.preventDefault();
const name = document.getElementById("signupName").value.trim();
const email = document.getElementById("signupEmail").value.trim();
const password = document.getElementById("signupPassword").value.trim();
const confirmPassword = document.getElementById("signupConfirm").value.trim();
const emailPattern = /^[^ ]+@[^ ]+\.[a-z]{2,3}$/;
if (name.length < 3) {
alert("Name must be at least 3 characters.");
return;
}
if (!email.match(emailPattern)) {
alert("Please enter a valid email address.");
return;
}
if (password.length < 6) {
alert("Password must be at least 6 characters.");
return;
}
if (password !== confirmPassword) {
alert("Passwords do not match.");
return;
}
alert("Signup successful! 🎉");
});
</script>
</body>
</html>