效果:
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/508ab65b6bc1bc85327df101fafa7523.png#pic_center)
代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>登录界面</title>
<style type="text/css">
*{
font-family: "微软雅黑";
border: 0px solid #464646;
margin-top: 15px;
}
#login{
margin-top: 100px;
margin-left: 537px;
text-align: center;
width: 400px;
height: 280px;
border: 2px solid #AAAAFF;
border-radius: 10px;
}
#login-lb{
font-size: 40px;
}
#btns input{
font-size: 16px;
margin: 0px 30px;
margin-top: 10px;
width: 80px;
height: 35px;
border: 1px solid #aaaaff;
border-radius: 10px;
}
#username,#passward{
width: 220px;
height: 25px;
border-radius: 10px;
color: #464646;
border: 1px solid #AAAAFF;
padding-left: 10px;
}
#username:visited,#passward:visited{
color: #363636;
}
#btns input:hover{
cursor: pointer;
}
</style>
</head>
<body>
<script type="text/javascript">
function check(){
if(document.getElementById("username").value == "bakabaka" && document.getElementById("passward").value == "jiushimima"){
alert("登录成功!");
}
else{
alert("用户名或密码错误!");
}
}
function reset(){
document.getElementById("username").value = "";
document.getElementById("passward").value = "";
}
</script>
<div id="login">
<div><label id="login-lb">登录</label></div>
<div>
<input type="text" id="username" placeholder="请输入密码:" />
</div>
<div>
<input type="password" id="passward" placeholder="请输入密码:" />
</div>
<div id="btns">
<input type="button" value="登录" onclick="check()" />
<input type="button" value="取消" onclick="reset()" />
</div>
</div>
</body>
</html>