<!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>
body{background: url(img/登录.jpg);
background-repeat: no-repeat;
background-size: 100%;
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;}
#container{
max-width:400px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 1);margin-top: 100px;}
h1{text-align: center;}
input[type="text"],input[type="password"]{
width: 95%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}
input[type="submit"]{
width: 100%;
padding: 10px;
background-color: #4caf50;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
.forgot-password{
text-align: right;
margin-bottom: 10px;
}
</style>
</head>
<body>
<div id="container">
<h1>登录</h1>
<form action="index.html" method="post">
<input type="text" id="username" placeholder="用户名/邮箱">
<input type="password" id="password" placeholder="密码">
<label>
<input type="checkbox">记住我
</label>
<div class="forgot-password">
<a href="#">忘记密码</a>
</div>
<input type="submit" value="登录" οnclick="return denglu()">
</form>
<script type="text/javascript">
function $(id){return document.getElementById(id)}
function denglu(){
var user=$("username").value;
var pass=$("password").value;
if(user==="admin"&&pass==="123456")
{
alert("用户名是:"+(document.getElementById("username").value)+
"密码是:"+(document.getElementById("password").value))
return true;
}
else{alert("账号密码错误,请重新输入")
return false;
}
}
</script>
</div>
</body>
</html>