-
Notifications
You must be signed in to change notification settings - Fork 5
/
王亦舟-20281256.html
107 lines (94 loc) · 2.35 KB
/
王亦舟-20281256.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
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f2f2f2;
}
.container {
width: 300px;
padding: 20px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
h1 {
text-align: center;
}
label {
display: block;
margin-bottom: 10px;
}
input[type="text"],
input[type="password"] {
width: 100%;
padding: 5px;
border: 1px solid #ccc;
border-radius: 3px;
}
input[type="submit"] {
width: 100%;
padding: 10px;
background-color: #4caf50;
border: none;
color: #fff;
font-weight: bold;
cursor: pointer;
}
.success-message,
.error-message {
margin-top: 10px;
padding: 10px;
border-radius: 3px;
}
.success-message {
background-color: #d4edda;
border: 1px solid #c3e6cb;
color: #155724;
}
.error-message {
background-color: #f8d7da;
border: 1px solid #f5c6cb;
color: #721c24;
}
</style>
</head>
<body>
<div class="container">
<h1>Login</h1>
<form id="loginForm">
<label for="username">Username:</label>
<input type="text" id="username" required>
<label for="password">Password:</label>
<input type="password" id="password" required>
<input type="submit" value="Login">
</form>
<div id="messageContainer"></div>
</div>
<script>
const loginForm = document.getElementById('loginForm');
const messageContainer = document.getElementById('messageContainer');
loginForm.addEventListener('submit', function(event) {
event.preventDefault();
const username = document.getElementById('username').value;
const password = document.getElementById('password').value;
if (username === 'admin' && password === 'password') {
showMessage('success', 'Login successful!');
} else {
showMessage('error', 'Invalid username or password!');
}
});
function showMessage(type, message) {
messageContainer.innerHTML = `<div class="${type}-message">${message}</div>`;
}
</script>
</body>
</html>