-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
80 lines (74 loc) · 2.47 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Animated Login Page</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<section>
<div class="leaves">
<div class="set">
<div><img src="leaf_01.png"></div>
<div><img src="leaf_02.png"></div>
<div><img src="leaf_03.png"></div>
<div><img src="leaf_04.png"></div>
<div><img src="leaf_01.png"></div>
<div><img src="leaf_02.png"></div>
<div><img src="leaf_03.png"></div>
<div><img src="leaf_04.png"></div>
</div>
</div>
<img src="bg.jpg" class="bg">
<img src="girl.png" class="girl">
<img src="trees.png" class="trees">
<div class="login">
<h2>Sign In</h2>
<form id="signupForm" action="#" onsubmit="return validateForm()">
<!-- Form fields -->
<div class="inputBox">
<input type="text" placeholder="Username" required
</div>
<div class="inputBox">
<input type="password" placeholder="Password" required
</div>
<div class="inputBox">
<input type="submit" value="Login" id="btn">
</div>
<div class="group">
<a href="#">Don't have an Account?</a>
<a href="Signup.html">Signup</a>
</div>
</div>
</form>
</section>
<script>
function welcomeMessage() {
alert("Welcome! Thanks for signing up.");
}
function validateForm() {
var username = document.getElementById("username").value;
var email = document.getElementById("email").value;
var password = document.getElementById("password").value;
var confirmPassword = document.getElementById("confirmPassword").value;
if (username === "" || email === "" || password === "" || confirmPassword === "") {
alert("All fields are required.");
return false;
}
if (password !== confirmPassword) {
alert("Passwords do not match.");
return false;
}
return confirm("Are you sure you want to submit this form?");
}
document.getElementById("signupForm").addEventListener("submit", function(event) {
// Form submission will only occur if validation passes
if (!validateForm()) {
event.preventDefault(); // Prevent default form submission if validation fails
} else {
welcomeMessage();
}
});
</script>
</body>
</html>