forked from mt-bjtu-practical/Front-end-exercise
-
Notifications
You must be signed in to change notification settings - Fork 0
/
易虹宇-20281027.html
104 lines (101 loc) · 3.1 KB
/
易虹宇-20281027.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fake美团登录</title>
</head>
<style>
hr.style_one {
border: 0;
height: 2px;
margin-top: 20px;
background: #333;
background-image: linear-gradient(to right,#ccc,#333,#ccc);
}
.line {
margin-top: 8px;
height: 4px;
width: auto;
border-radius: 2px;
}
.center {
text-align: center;
}
#sign_border {
border-style: solid;
border-color: rgb(255, 168, 25);
background-color: rgb(228, 246, 255);
padding: 10px;
}
.input_control {
margin-top: 10px;
padding: 3px;
}
#login_text {
margin-top: 15px;
margin-bottom: 15px;
}
input[type="text"]{
color: #262626;
width: 83%;
border-radius: 8px;
border-color: rgb(255, 168, 25);
}
input[type="password"]{
color: #262626;
width: 83%;
border-radius: 8px;
border-color: rgb(255, 168, 25);
}
input[type="submit"]{
margin-top: 15px;
background-color: rgb(255, 200, 0);
cursor: pointer;
border: none;
padding: 5px;
width: 20%;
}
input[type="submit"]:hover{
background-color: rgb(255, 149, 0);
}
</style>
<body>
<h2>Fake美团 | 登陆页面</h2>
<hr class="style_one">
<div style="width: 400px; margin: auto; padding-top: 100px;">
<div id="sign_border" class="sign_container">
<div class="center">
<h4 id="login_text">账号登录</h4>
</div>
<div class="line" style="background: rgb(255, 168, 25);"></div>
<form id="login">
<div class="input_control">账号:
<input type="text" name="input_name" id="name_input" placeholder="请输入账号:">
</div>
<div class="input_control">密码:
<input type="password" name="input_psw" id="psw_input" placeholder="请输入密码:">
</div>
<center><input type="submit" name="submit" id="submit" value="登录"></center>
</form>
</div>
</div>
<script>
document.getElementById('login').addEventListener('submit',function(event){
event.preventDefault();
var usernameInput=document.getElementsByName('input_name')[0];
var passwordInput=document.getElementsByName('input_psw')[0];
var username=usernameInput.value;
var password=passwordInput.value;
var validusername='user';
var validpassword='password';
if (username==validusername&&password==validpassword){
alert("登录成功!");
}
else{
alert("用户名或密码不正确!请重新输入");
}
});
</script>
</body>
</html>