-
Notifications
You must be signed in to change notification settings - Fork 5
/
胡晓赟-20221068.html
146 lines (128 loc) · 3.96 KB
/
胡晓赟-20221068.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
box-sizing: border-box;
}
/* body 样式 */
body {
font-family: Arial;
margin: 0;
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
opacity: 0.8;
}
/* 标题 */
.header {
padding: 80px;
text-align: center;
background: #1abc9c;
color: white;
}
/* 标题字体加大 */
.header h1 {
font-size: 40px;
}
/* 主要的内容区域 */
.main {
-ms-flex: 70%;
/* IE10 */
flex: 70%;
background-color: white;
padding: 20px;
}
/* 底部 */
.footer {
padding: 20px;
text-align: center;
background: #ddd;
}
/* 响应式布局 - 在屏幕设备宽度尺寸小于 700px 时, 让两栏上下堆叠显示 */
@media screen and (max-width: 700px) {
.row {
flex-direction: column;
}
}
/* 响应式布局 - 在屏幕设备宽度尺寸小于 400px 时, 让导航栏目上下堆叠显示 */
@media screen and (max-width: 400px) {
.navbar input {
float: none;
width: 100%;
}
}
.button {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 10px;
cursor: pointer;
border-radius: 5px;
}
.input-field {
margin-bottom: 10px;
}
.input-field input[type="text"],
.input-field input[type="password"] {
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
width: 200px;
font-size: 16px;
}
</style>
</head>
<body>
<div class="header">
<h1>登录页面</h1>
</div>
<div class="main">
<h2 align="center">注册或登录</h2>
<form align="center">
请输入用户名:<div class="input-field"><br><input type="text" id="user_name" required /><br></div>
请输入用户密码:<div class="input-field"><br><input type="password" id="user_pass" required /><br></div>
<input type="submit" value="忘记密码" class="button">
<input type="button" onclick="login()" value="登陆" class="button">
<input type="submit" value="注册" class="button">
</form>
</div>
<script type="text/javascript">
let user_info = [{
user_name: 'hxy',
user_pass: '20221068'
},
{
user_name: 'yhw',
user_pass: '20211054'
},
]
function login() {
let user_name = document.getElementById('user_name').value;
let user_pass = document.getElementById('user_pass').value;
let account = user_info.filter(function (e) {
return e.user_name == user_name
})[0];
if (!account) {
alert('用户名不存在');
} else {
if (account.user_name == user_name && account.user_pass == user_pass) {
alert('登陆成功');
} else {
alert('密码错误');
}
}
}
</script>
<div class="footer">
<h2>Authored by: XiaoYun Hu 20221068</h2>
</div>
</body>
</html>