html+js:
//自行导入jquery包
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>登录页面</title>
<!--title改变图案-->
<link href="images/xuehua.png" rel="icon" type="image/x-ico">
<!--<link rel="stylesheet" href="../鼠标样式2/css/shubiao.css" type="text/css">-->
<link rel="stylesheet" href="CSS/denglu.css">
<style type="text/css">
html{
cursor:url(images/miku1.png),auto;
}
input{
cursor:url(images/miku1.png),auto;
}
.deng:hover{
}
</style>
</head>
<body>
<div>
<div class="zhu_button">
<span>登录</span>
</div>
<!--<div class="zhu_button_two">
<span>注册</span>
</div>-->
</div>
<div class="deng_lu" style="display: none;">
<div class="guanbi">
×
</div>
<h1>用户登录</h1>
<form action="zhu.html" id="meForm">
<input class="search" type="text" placeholder="用户名" id="zhang">
<br>
<input class="search" type="password" placeholder="密码" id="mi">
<br>
<input type="submit" value="登录" class="deng">
</form>
</div>
<div style="width: 100%; height: 1000px; display: none;"></div>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript">
$(function (){
//显示登录按钮
$(".zhu_button").toggle(function (){
$(".deng_lu").show("sold");
/* $(".zhu_ce").hide("sold");*/
$(this).addClass("zhui1");
},function (){
$(".deng_lu").hide("sold");
}).hover(function (){
$(this).addClass("zhui1");
$(this).removeClass("zhui2");
},function (){
});
//表单验证账号和密码
$("#meForm").submit(function (){
let zhangHao = $("#zhang").val();
let miMa = $("#mi").val();
if (zhangHao===""){
alert("账号不能为空");
return false;
}
if (zhangHao!=="王二傻"){
alert("用户名必须为王二傻");
return false;
}
if (miMa!=="zmyzuishuai"){
alert("密码必须为zmyzuishuai");
return false;
}
})
//关闭登录页面时
$(".guanbi").click(function (){
$(".deng_lu").hide("sold");
$(".zhu_button").addClass("zhui2");
})
})
</script>
</body>
</html>
css:
*{
padding: 0px;
margin:0px;
}
body{
background:url(../images/MrUnd3rstandiing_k7j73q.jpg) no-repeat;
background-size: cover;
}
/*用户登录弹出页面*/
.deng_lu{
width: 550px;
height: 400px;
background-color: rgba(255,255,255,0.25);
border-radius:19px;
margin:150px auto;
text-align: center;
padding: 10px;
}
h1{
color: #7bbfea;
margin-top: 40px;
user-select:none;
}
.search{
width:280px;
height:40px;
border-radius:40px;
border:2px solid lightblue;
outline:none;
text-indent:12px;
color:#666;
font-size:16px;
padding:0;
/*-webkit-transition:width 1s;*/
line-height: 39px;
margin-top: 30px;
}
.deng{
width: 200px;
height: 50px;
color: white;
margin-top: 50px;
border-radius: 40px;
border: 2px solid #afdfe4;
background: #90d7ec;
cursor: url(../images/miku1.png);
transition: background 0.5s, color 0.5s;
-webkit-transition: background 0.5s, color 0.5s;
}
/*.deng:hover{
color: black;
background: yellow;
}*/
/*点击出现登录页面的div*/
.zhu_button{
width: 200px;
height: 50px;
background-color: rgba(255,255,255,0.25);
text-align: center;
color: white;
line-height: 50px;
border-top-right-radius: 13px;
border-bottom-right-radius: 13px;
position: absolute;
top: 150px;
-webkit-transition:width 0.5s ease-out;
user-select:none;
}
.zhu_button_two{
width: 200px;
height: 50px;
background-color: rgba(255,255,255,0.25);
text-align: center;
color: white;
line-height: 50px;
border-top-right-radius: 13px;
border-bottom-right-radius: 13px;
position: absolute;
top: 260px;
-webkit-transition:width 0.5s;
user-select:none;
}
/*点击出现注册页面的按钮*/
/*.zhu_ce{
width: 550px;
height: 400px;
background-color: rgba(255,255,255,0.25);
border-radius:19px;
margin:150px auto;
text-align: center;
padding: 10px;
}*/
/*追加鼠标放上去后的样式*/
.zhui1{
width:300px;
background-color: rgba(123,191,234,0.9);
}
.zhui2{
width: 200px;
background-color: rgba(255,255,255,0.25);
}
/*关闭按钮*/
.guanbi{
width: 40px;
height: 40px;
border: 3px solid rgb(123,191,234);
border-radius: 50%;
color: white;
line-height: 40px;
font-size: 20px;
position: relative;
left: 500px;
user-select:none;
}