forked from mt-bjtu-practical/Front-end-exercise
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path张昊-20281028.html
221 lines (219 loc) · 6.71 KB
/
张昊-20281028.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>张昊的登录页面</title>
<style>
* {
margin: 0;
padding: 0;
}
html {
height: 100%;
}
body {
height: 100%;
}
.container {
height: 100%;
background-color: #000;
}
.loginbox {
background-color: #fff;
width: 358px;
height: 560px;
padding: 0 50px;
position: relative;
left: 50%;
top: 44%;
transform: translate(-50%, -50%);
}
.head {
font-size: 36px;
font-weight: bold;
text-align: center;
line-height: 200px;
font-family: Arial, sans-serif;
}
.inputline_1 {
display: block;
width: 90%;
margin-bottom: 20px;
border: 0;
padding: 10px;
border-bottom: 1px solid #7f7f7f;
font-size: 15px;
outline: none;
font-family: Arial, sans-serif;
}
.inputline_2 {
display: block;
width: 90%;
margin-bottom: 20px;
border: 0;
padding: 10px;
border-bottom: 1px solid #7f7f7f;
font-size: 15px;
outline: none;
flex: 1;
margin-right: 10px;
margin-top: 10px;
font-family: Arial, sans-serif;
}
.inputline_1::placeholder {
text-transform: none;
}
.inputline_2::placeholder {
text-transform: none;
}
.formcontainer {
position: relative;
}
.button {
text-align: center;
padding: 10px;
width: 90%;
margin-top: 40px;
background-color: #000;
color: #fff;
font-weight: bold;
font-size: 17px;
cursor: pointer;
}
.message {
text-align: center;
line-height: auto;
}
a {
text-decoration-line: none;
color: #007bff;
}
.topbar {
background-color: #fff;
color: #000;
padding: 10px;
display: flex;
justify-content: space-between;
align-items: center;
}
.topbar h1 {
text-decoration-line: none;
color: #000;
font-size: 20px;
margin-right: auto;
}
.topbar a {
color: #000;
text-decoration: none;
margin-left: 10px;
font-size: 15px;
}
.topbar a:hover {
color: #7f7f7f;
}
.changebutton {
text-align: center;
padding: 10px;
width: 90%;
margin-top: 10px;
color: #000;
font-weight: bold;
font-size: 15px;
cursor: pointer;
}
.changebutton:hover {
color: #7f7f7f;
}
.verifybutton {
text-align: center;
padding: 10px;
width: auto;
color: #000;
font-weight: bold;
font-size: 15px;
cursor: pointer;
display: none;
position: absolute;
top: 0;
right: 0;
margin-right: 10px;
transform: translateY(115%);
}
.verifybutton:hover {
color: #7f7f7f;
}
.footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
color: #FFF;
padding: 10px;
text-align: center;
font-size: 14px;
}
</style>
</head>
<body>
<div class="container">
<div class="topbar">
<h1>张昊的登录页面</h1>
<a href="#">进入官网</a>
<a href="#">PC安装客户端</a>
<a href="#">手机安装客户端</a>
</div>
<div class="loginbox">
<div class="head">账号登录</div>
<div class="formcontainer">
<input type="text" name="账号" placeholder="输入账号" class="inputline_1">
<input type="password" name="密码" placeholder="输入密码" class="inputline_2">
<button class="verifybutton">获取验证码</button>
<div class="button" onclick="login()">登录</div>
</div>
<div class="changebutton" onclick="changefunc()">切换登录方式</div><br>
<div class="message">
<a href="#">点击此处注册</a><br><br>
<a href="#">忘记账号/密码</a>
</div>
</div>
<div class="footer">
Tips: 用户名: admin 密码: 123456 手机验证码登录与其他按钮、超链接功能仅供演示~
</div>
</div>
<script>
function changefunc() {
var head = document.querySelector('.head')
var inputline_1 = document.querySelector('.inputline_1')
var inputline_2 = document.querySelector('.inputline_2')
var verifybutton = document.querySelector('.verifybutton')
if (head.textContent === '账号登录') {
head.textContent = '手机验证码登录'
inputline_1.placeholder = '输入手机号'
inputline_2.placeholder = '输入验证码'
inputline_1.value = ''
inputline_2.value = ''
verifybutton.style.display = 'inline-block'
} else {
head.textContent = '账号登录'
inputline_1.placeholder = '输入账号'
inputline_2.placeholder = '输入密码'
inputline_1.value = ''
inputline_2.value = ''
verifybutton.style.display = 'none'
}
}
function login() {
var id = document.querySelector('.inputline_1').value
var pw = document.querySelector('.inputline_2').value
if(id === 'admin' && pw === '123456') {
alert('登录成功')
}
else {
alert('用户名或密码不正确,请重新登录')
}
}
</script>
</body>
</html>