localStorage登錄頁記住密碼(藝博會)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>登錄頁</title>
<link rel="stylesheet" href="css/basic.css" type="text/css" />
<link rel="stylesheet" href="css/login.css" type="text/css" />
<script type="text/javascript" src="js/jquery-1.9.1.min.js" ></script>
<script type="text/javascript" src="js/login.js" ></script>
</head>
<body>
<div class="wrap">
<div class="topWrap" >
<i class="loginLogo"></i>
<div class="logoText">入駐商家工作平臺</div>
</div>
<div class="contentBg">
<div class="bg"></div>
<div class="contentWrap">
<div class="container">
<div class="title">用戶登錄</div>
<form action="" method="post" >
<div class="iptWrap iptWrap01">
<div class="iconTel"></div>
<input class="iptTel" type="text" name="" placeholder="請輸入手機號" maxlength="11" style="border: #fff solid 1px;" />
</div>
<div class="iptWrap iptWrap02">
<div class="iconPasw"></div>
<input class="iptPasw" type="password" name="" placeholder="請輸入密碼" style="border: #fff solid 1px;" />
<div class="open"></div>
<div class="close"></div>
</div>
<a href="javascript:void(0)" class="forgetPasw">忘記密碼?</a>
<div class="bottom">
<div class="square">
<input id="remember" type="checkbox" />
<div class="remember">記住我</div>
</div>
<button class="iptLogin" type="submit" onclick="loginBtn_click()" >登 錄</button>
</div>
</form>
<div class="greyLine"></div>
<a class="upLoad" href="javascript:void(0)">掃描右側二維碼,下載今日財界客戶端→</a>
</div>
<div class="code"></div>
</div>
</div>
<div class="footer">
<div class="copyright">北京網高科技股份有限公司 Copyright ? 2007-2018 All Rights Reserved | 客服電話:010-65910258 </div>
</div>
</div>
<script>
$(document).ready(function(){
var strName = localStorage.getItem(‘keyName‘);
var strPass = localStorage.getItem(‘keyPass‘);
var strRem = localStorage.getItem(‘keyRem‘);
if(strName){
$(‘.iptTel‘).val(strName);
}
if(strPass){
$(‘.iptPasw‘).val(strPass);
}
if(strRem){
$(‘#remember‘).attr("checked",true);
}
});
function loginBtn_click(){
var strName = $(‘.iptTel‘).val();
var strPass = $(‘.iptPasw‘).val();
var strRem = $(‘#remember‘).is(‘:checked‘);
if($(‘#remember‘).is(‘:checked‘)){
localStorage.setItem(‘keyName‘,strName);
localStorage.setItem(‘keyPass‘,strPass);
localStorage.setItem(‘keyRem‘,strRem);
}else{
localStorage.removeItem(‘keyPass‘);
localStorage.removeItem(‘keyRem‘);
}
}
</script>
</body>
</html>
localStorage登錄頁記住密碼(藝博會)