-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path艾孜海尔-20281102.html
85 lines (76 loc) · 2.53 KB
/
艾孜海尔-20281102.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
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
<style>
body {
background-color: #f2f2f2;
}
form {
background-color: #fff;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
padding: 20px;
margin: 50px auto;
max-width: 400px;
}
input[type="text"], input[type="password"] {
border: none;
border-radius: 3px;
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
display: block;
font-size: 16px;
margin: 10px 0;
padding: 10px;
width: 100%;
}
input[type="submit"] {
background-color: #4CAF50;
border: none;
border-radius: 3px;
color: #fff;
cursor: pointer;
font-size: 16px;
padding: 10px;
width: 100%;
}
input[type="submit"]:hover {
background-color: #3e8e41;
}
</style>
</head>
<body>
<form>
<h1>Login</h1>
<label for="username">Username:</label>
<input type="text" id="username" name="username" required>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
<input type="submit" value="Login">
</form>
<script>
// 获取表单元素
var form = document.querySelector("form");
var usernameInput = document.querySelector("#username");
var passwordInput = document.querySelector("#password");
// 定义正确的用户名和密码
var correctUsername = "admin";
var correctPassword = "password";
// 监听表单提交事件
form.addEventListener("submit", function(event) {
event.preventDefault(); // 阻止表单默认提交行为
// 获取输入的用户名和密码
var username = usernameInput.value;
var password = passwordInput.value;
// 验证用户名和密码是否正确
if (username === correctUsername && password === correctPassword) {
// 如果验证通过,显示登录成功的提示框
alert("Login successful!");
} else {
// 如果验证不通过,显示错误信息
alert("Incorrect username or password!");
}
});
</script>
</body>
</html>