-
Notifications
You must be signed in to change notification settings - Fork 0
/
user_registration.html
185 lines (168 loc) · 5.97 KB
/
user_registration.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<!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>Contact Messages | Firebase</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #f4f4f4;
}
.container {
width: 90%;
max-width: 500px;
padding: 20px;
border-radius: 10px;
box-shadow: 0px 5px 25px rgba(0, 0, 0, 0.2);
background-color: #fff;
}
.container form {
display: flex;
flex-direction: column;
}
.inputBox {
margin: 10px 0;
position: relative;
}
.inputBox input, .inputBox textarea {
width: 100%;
padding: 10px;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 5px;
font-size: 16px;
color: #444;
}
.inputBox input:focus, .inputBox textarea:focus {
border-color: #0077ff;
}
.inputBox label {
margin-bottom: 5px;
font-weight: bold;
}
.inputBox button {
width: 100%;
padding: 10px;
border: none;
background: #0077ff;
color: #fff;
font-size: 18px;
font-weight: bold;
cursor: pointer;
border-radius: 5px;
transition: background 0.3s ease;
}
.inputBox button:hover {
background: #0011ff;
}
.alert {
display: none;
background: #00ff6a;
padding: 10px;
border-radius: 5px;
text-align: center;
font-size: 18px;
font-weight: bold;
}
.tick {
position: absolute;
right: 10px;
top: 50%;
transform: translateY(-50%);
display: none;
color: green;
font-size: 24px;
}
footer {
width: 100%;
padding: 10px 20px;
background-color: #333;
color: #fff;
text-align: center;
position: fixed;
bottom: 0;
}
</style>
</head>
<body>
<h1>User Registration Form</h1>
<div class="container">
<form id="contactForm">
<div class="alert">Your message sent</div>
<div class="inputBox">
<label for="name"><B>Enter your Full name:</B></label><br>
<input type="text" id="name" placeholder="abc xyz" required />
</div>
<div class="inputBox">
<label for="emailid"><B>Enter your email id:</B></label><br>
<input type="email" id="emailid" placeholder="abc@gmail.com" required />
</div>
<div class="inputBox">
<label for="phone"><B>Enter your phone no (with country code):</B></label><br>
<input type="tel" id="phone" placeholder="+XX XXXXXXXXXX" required />
</div>
<div class="inputBox">
<label for="password"><B>Enter your password:</B></label><br>
<input type="password" id="password" placeholder="Enter your password" required />
</div>
<div class="inputBox">
<input type="password" id="confirmPassword" placeholder="Confirm your password" required />
<span class="tick">✔</span>
</div>
<div class="inputBox">
<label for="message"><B>Enter your Messages:</B></label><br>
<textarea id="message" placeholder="Write why you need the code......" required></textarea>
</div>
<div class="inputBox">
<button type="submit">Submit</button>
</div>
</form>
</div>
<footer>
<p>© 2024 My Website. All rights reserved.</p>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/firebase/7.14.1-0/firebase.js"></script>
<script src="./mail.js"></script>
<script>
document.getElementById('contactForm').addEventListener('submit', function(event) {
event.preventDefault(); // Prevent the form from submitting the traditional way
var password = document.getElementById('password').value;
var confirmPassword = document.getElementById('confirmPassword').value;
var alertBox = document.querySelector('.alert');
if (password !== confirmPassword) {
alert("Passwords do not match!");
return;
}
// Assuming form is valid, you can proceed with form submission (e.g., send data to server)
alertBox.style.display = 'block'; // Show alert box
alertBox.textContent = 'You registered successfully!';
// Hide the alert box after 3 seconds
setTimeout(function() {
alertBox.style.display = 'none';
}, 3000);
// Here you would typically send the form data to the server or Firebase
});
document.getElementById('confirmPassword').addEventListener('input', function() {
var password = document.getElementById('password').value;
var confirmPassword = document.getElementById('confirmPassword').value;
var tick = document.querySelector('.tick');
if (password === confirmPassword && confirmPassword !== "") {
tick.style.display = 'inline';
} else {
tick.style.display = 'none';
}
});
</script>
</body>
</html>