forked from mt-bjtu-practical/Front-end-exercise
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path张伟韬-20281098.html
317 lines (266 loc) · 9.3 KB
/
张伟韬-20281098.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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>登录</title>
<style>
/***********************默认样式*********************************************/
* {
margin: 0;
padding: 0;
text-decoration: none;
list-style: none;
box-sizing: border-box;
}
.clearfix::before,
.clearfix::after {
content: '';
display: block;
clear: both;
}
input,
button {
outline: none;
}
html {
font-size: 10px;
}
body {
font-size: 1.4rem;
}
a {
color: purple;
}
/*************************主体设计**************************************/
/*主体*/
#content {
width: 50rem;
/*height: 60rem;*/
border: 0.1rem solid #cccccc;
margin: 5rem auto;
}
/*头部*/
/*#content .content-header{*/
/* border: 0.1rem solid blue;*/
/*}*/
#content .content-header a {
height: 6rem;
width: 50%;
background-color: #ebebeb;
color: #666666;
display: inline-block;
float: left;
/*水平居中*/
text-align: center;
/*垂直居中*/
line-height: 6rem;
font-size: 1.6rem;
}
#content .content-header a.current {
background-color: transparent;
color: purple;
}
/*内容*/
#content .content-body {
/*background-color: red;*/
padding: 4rem;
}
#content .content-body .dom {
width: 100%;
display: none;
}
#content .content-body .dom .s1 {
/*background-color: red;*/
margin-bottom: 2rem;
}
#content .content-body .dom .s1 h4 {
color: black;
}
#content .content-body .dom .s1 input {
width: 100%;
height: 4rem;
margin-top: 0.5rem;
padding-left: 0.5rem;
border-radius: 5px;
border: 1px solid #cccccc;
}
#content .content-body .dom .s2 {
margin-bottom: 2rem;
color: black;
font-size: 1.4rem;
}
#content .content-body .dom .btn {
width: 100%;
height: 3.5rem;
border: none;
background-color: purple;
color: white;
font-size: 1.8rem;
margin-bottom: 2rem;
text-align: center;
line-height: 3.5rem;
border-radius: 5px;
}
/*#content .content-body .dom .dom-footer{*/
/* background-color: red;*/
/*}*/
#content .content-body .dom .dom-footer .login-another {
/*background-color: red;*/
color: #666666;
margin-bottom: 2rem;
text-align: center;
line-height: 100%;
}
#content .content-body .dom .dom-footer .login-another span {
margin: 0 0.5rem;
}
#content .content-body .dom .dom-footer .login-three {
/*background-color: red;*/
text-align: center;
line-height: 100%;
color: #666666;
margin-top: 2rem;
}
#content .content-body .dom .dom-footer .login-three span {
margin-bottom: 2rem;
font-size: 1.2rem;
position: relative;
}
/*创建字体前的线条*/
#content .content-body .dom .dom-footer .login-three span::before {
content: '';
display: inline-block;
width: 12rem;
border: 1px solid #e0e0e0;
position: absolute;
top: 50%;
left: -125%;
}
/*创建字体后的线条*/
#content .content-body .dom .dom-footer .login-three span::after {
content: '';
display: inline-block;
width: 12rem;
border: 1px solid #e0e0e0;
position: absolute;
top: 50%;
right: -125%;
}
#content .content-body .dom .dom-footer .login-three img {
margin-top: 2rem;
height: 3rem;
width: 3rem;
border-radius: 50%;
}
#content .content-body .dom .msg-code input {
width: 49%;
}
#content .content-body .dom .msg-code input:last-child {
color: #666666;
cursor: pointer;
}
</style>
</head>
<body>
<!--主体-->
<section id="content">
<!--头部-->
<div class="content-header clearfix">
<a href="javaScript:;" class="current">账号登录</a>
<a href="javaScript:;">验证码登录</a>
</div>
<!--内容-->
<div class="content-body">
<div class="dom" style="display: block">
<form action="" name="form1" method="post">
<p>默认用户名123 密码123</p>
<div class="s1">
<h4>账号</h4>
<input type="text" name="user" placeholder="用户名/手机/邮箱">
</div>
<div class="s1">
<h4>密码</h4>
<input type="text" name="pwd" placeholder="请输入密码">
</div>
<div class="s2">
<input type="checkbox">
<span> 记住密码</span>
</div>
<input type="submit" value="登 录" class="btn" onclick="mycheck()">
</form>
<div class="dom-footer">
<div class="login-another">
<a href="#">找回密码</a>
<span>|</span>
<span>还没有注册账号</span>
<a href="#">立即注册</a>
</div>
<div class="login-three">
<span>第三方账号直接登录</span>
</div>
</div>
</div>
<div class="dom">
<form action="" name="form2" method="post">
<div class="s1">
<h4>手机号码</h4>
<input type="text" name="phone" placeholder="填写你的手机号码作为登录账号">
</div>
<div class="s1 msg-code">
<h4>短信验证码</h4>
<input type="text" name="msgcode" placeholder="填写短信验证码">
<input type="button" name="bnt" value="获取短信验证码">
</div>
<input type="submit" value="登 录" class="btn" onclick="mycheck()">
</form>
<div class="dom-footer">
<div class="login-three">
<span>第三方账号直接登录</span>
</div>
</div>
</div>
</div>
</section>
<script type="application/javascript">
window.onload = function () {
let as = document.getElementsByClassName('content-header')[0].getElementsByTagName('a');
let contents = document.getElementsByClassName("dom");
for (let i = 0; i < as.length; i++) {
let a = as[i];
a.id = i;
// 设置每个a标签的onclick事件
a.onclick = function () {
// 清楚所有标签的css设置,隐藏dom标签
for (let j = 0; j < as.length; j++) {
as[j].className = "";
contents[j].style.display = "none";
}
// 设置当前标签样式及当前标签下的所有dom标签可见
this.className = 'current';
// 当前div可见
contents[this.id].style.display = 'block';
}
}
}
function mycheck() {
//判断用户名和密码是否正确
if (form1.user.value == "123" && form1.pwd.value == "123") {
alert("成功登录!");
return;
}
//判断用户名是否为空
if (form1.user.value == "") {
alert("用户名不能为空,请输入用户名!")
form1.user.focus();
return;
}
//判断密码是否为空
if (form1.pwd.value == "") {
alert("密码不能为空,请输入密码!")
form1.pwd.focus();
return;
}
}
</script>
</body>
</html>