-
Notifications
You must be signed in to change notification settings - Fork 5
/
史博彦_20281322.html
129 lines (110 loc) · 2.87 KB
/
史博彦_20281322.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=, initial-scale=1.0">
<title>Document</title>
<style>
/* 样式:边框的表单 */
form {
border: 3px solid #f1f1f1;
}
/* 样式:全宽度输入框 */
input[type=text],
input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
/* 样式:所有按钮的通用样式 */
button {
background-color: #04AA6D;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
}
/* 样式:按钮的鼠标悬停效果 */
button:hover {
opacity: 0.8;
}
/* 样式:取消按钮的额外样式(红色) */
.cancelbtn {
width: auto;
padding: 10px 18px;
background-color: #f44336;
}
/* 样式:容器内部的头像图像居中 */
.imgcontainer {
text-align: center;
margin: 24px 0 12px 0;
}
/* 样式:头像图像 */
img.avatar {
width: 40%;
border-radius: 50%;
}
/* 样式:容器的内边距 */
.container {
padding: 16px;
}
/* 样式:“忘记密码”文本 */
span.psw {
float: right;
padding-top: 16px;
}
/* 样式:在超小屏幕上改变span和取消按钮的样式 */
@media screen and (max-width: 300px) {
span.psw {
display: block;
float: none;
}
.cancelbtn {
width: 100%;
}
}
</style>
</head>
<body>
<div class="imgcontainer">
<img src="https://img.sj33.cn/uploads/202301/7-23011H0105JD.png" alt="Avatar" class="avatar">
</div>
<div class="container">
<label for="uname"><b>Username</b></label>
<!-- 输入框:用户名 -->
<input type="text" placeholder="Enter Username" id="uname" required>
<label for="psw"><b>Password</b></label>
<!-- 输入框:密码 -->
<input type="password" placeholder="Enter Password" id="psw" required>
<!-- 按钮:登录 -->
<button type="submit" onclick="login()">Login</button>
<label>
<input type="checkbox" checked="checked" name="remember"> Remember me
</label>
</div>
<div class="container" style="background-color:#f1f1f1">
<!-- 按钮:取消 -->
<button type="button" class="cancelbtn">Cancel</button>
<!-- “忘记密码”文本 -->
<span class="psw">Forgot <a href="#">password?</a></span>
</div>
</body>
<script>
// 登录函数
function login() {
var username = document.getElementById("uname").value;
var psw = document.getElementById("psw").value;
// 检查用户名和密码是否匹配
if (username == "shi" && psw == "123") {
alert("ok");
} else {
alert("no");
}
}
</script>
</html>