-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
91 lines (89 loc) · 2.86 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
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Registration Form</title>
<style>
body {
font-family: Arial, sans-serif;
background: linear-gradient(to bottom, #ffffff, #f0f0f0);
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.container {
background-color: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
text-align: center;
background: linear-gradient(to right, #ff7e5f, #feb47b); /* Gradient background */
}
h2 {
margin-bottom: 20px;
}
input[type="text"], input[type="password"], input[type="email"], textarea {
width: 100%;
padding: 10px;
margin: 10px 0;
border: 1px solid #ccc;
border-radius: 5px;
box-sizing: border-box;
}
button {
display: block;
width: 100%;
padding: 10px 20px;
background-color: #4CAF50;
border: none;
color: white;
cursor: pointer;
border-radius: 4px;
}
button:hover {
background-color: #45a049;
}
#error-message {
color: red;
margin-top: 10px;
}
</style>
</head>
<body>
<div class="container">
<h2>Registration Form</h2>
<input type="text" id="username" placeholder="Username">
<input type="email" id="email" placeholder="Email">
<input type="password" id="password" placeholder="Password">
<textarea id="address" placeholder="Address"></textarea>
<button onclick="register()">Register</button>
<div id="error-message"></div>
</div>
<script>
function register() {
var username = document.getElementById('username').value;
var email = document.getElementById('email').value;
var password = document.getElementById('password').value;
var address = document.getElementById('address').value;
var errorMessage = document.getElementById('error-message');
// Basic validation
if (username.trim() === '' || email.trim() === '' || password.trim() === '' || address.trim() === '') {
errorMessage.textContent = 'All fields are required.';
} else {
// Perform registration logic (for demonstration, just displaying alert)
alert('Registration successful!\nUsername: ' + username + '\nEmail: ' + email + '\nAddress: ' + address);
// Clear form fields
document.getElementById('username').value = '';
document.getElementById('email').value = '';
document.getElementById('password').value = '';
document.getElementById('address').value = '';
// Clear error message
errorMessage.textContent = '';
}
}
</script>
</body>
</html>