拿走请三联,并注明出处!
没有上传原背景图,使用的话需自己更改图片名称
可连接注册界面,和用户照片墙,此文只有登录界面代码,代码存在些许问题,望观看的大佬们多多指教!
<!DOCTYPE html>
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>登陆</title>
<style>
* {
margin: 0;
padding: 0;
}
html {
height: 100%;
width: 100%;
overflow: hidden;
margin: 0;
padding: 0;
background: url(w3.jpeg) no-repeat 0px 0px;
background-repeat: no-repeat;
background-size: 100% 100%;
-moz-background-size: 100% 100%;
}
body {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
}
#center {
width:25%;
display: flex;
justify-content: center;
align-items: center;
height: 50%;
background-color: rgba(250, 249, 246, 0.479);
border-radius: 50%;
}
p {
margin-top: 30px;
margin-left: 20px;
color: rgb(51, 59, 59);
}
input {
margin-left: 15px;
border-radius: 5px;
border-style: hidden;
height: 30px;
width: 140px;
background-color: rgba(119, 173, 209, 0.5);
outline: none;
color: #ffffff;
padding-left: 10px;
}
.button {
border-color: cornsilk;
background-color: rgba(100, 149, 237, .7);
color: aliceblue;
border-style: hidden;
border-radius: 5px;
width: 100px;
height: 31px;
font-size: 16px;
}
a{
font-size: 17px;
color:rgb(38, 135, 247);
}
</style>
</head>
<body>
<div id="center">
<form action="">
<h1 style="text-align: center;color:rgba(56, 55, 52, 0.788)">登录</h1><br>
<hr><br>
<p>账号<input type="text" placeholder="请输入邮箱" id="email"/></p>
<p>密码<input type="password" placeholder="密码长度至少为六位" id="passworld"/></p>
<div style="text-align: center;margin-top: 30px;">
<input type="submit" class="button" value="登陆">
<input type="reset" class="button" οnclick="jumpRe()" value="注册"><br><br><br>
<a href="#" id="a" style=text-align:middle;>忘记密码?</a>
</div>
</form>
</div>
<script language="javascript" type="text/javascript">
function jumpRe(){
window.location.href="re.html";
}
document.getElementById("a").onclick = function click(){
window.location.href="re.html";
}
//判断邮箱格式
email.onchange = function(){
var email = this.value;
var reg = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/;
if(reg.test(email)){
alert("邮箱格式正确");
}else{
alert("邮箱格式不正确");
}
}
//判断密码格式
passworld.onchange = function(){
var passwolrd = this.value;
var reg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,12}$/;
if(reg.test(passworld)){
}else{
alert("密码格式不正确");
}
}
function submit() {
var pwd1 = document.getElementById("passworld").value;
var e = document.getElementById("email").value;
var pwd2=localStorage.getItem("password");
var e2=localStorage.getItem("email");
if(pwd1==pwd2&&e==e2)
window.location.href="照片墙.html";
else
alert("账号或密码不正确");
}
</script>
</body>
</html>