登陆时候记住账号密码
2014-02-20 16:11
225 查看
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>游戏联运合作首页</title>
<LINK rel=stylesheet type=text/css href="css/index.css" />
<script type="text/javascript" src="./js/jquery-1.9.1.min.js"></script>
<script src="./js/jquery-1.9.1.js"></script>
<script src="./js/jquery-ui.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="./js/jqModal.js"></script>
<script type="text/javascript">
function checkmail(){
var a =$(".getemail").val();
if (a== "" || a.length == 0) {
$("#Eerror").css("color", "black");
$("#Eerror").html("请输入邮箱!");
return ;
} else {
var developEmailReg = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z_-]+)+$/;
if (!developEmailReg.test(a)) {
$("#Eerror").css("color", "black");
$("#Eerror").html("邮箱地址错误!");
return ;
}else{
$("#Eerror").html("");
$("#sub2").submit();
}
}
}
function changeimgover(){
$("#logchage").attr("src","pic/onlog.png");
}
function changeimgout(){
$("#logchage").attr("src","pic/nolog.png");
}
function check(){
/* var a =window.screen.height;
var b=window.screen.width; */
var che=document.getElementById("checkboxid");
if(che.checked){
username=$("#account").val();
password=$("#pwd").val();
setCookie('username',username,365);
setCookie('password',password,365);
}
$("#sub1").submit();
}
function clearmsg(){
$(".getacc").val("");
$(".getemail").val("");
$("#msg").html("");
}
function clearmail(){
$(".getemail").val("");
}
jQuery(document).ready(function() {
jQuery("#pop").jqm({
modal: true,
overlay: 30,
onShow: function(h) {
h.w.fadeIn(500);
},
onHide: function(h) {
h.o.remove();
h.w.fadeOut(500);
}
}).jqmAddClose("#close");
jQuery("#show").click(function() {
jQuery("#pop").jqmShow();
});
});
document.onkeydown = function(evt){
var che=document.getElementById("checkboxid");
if(che.checked){
username=$("#account").val();
password=$("#pwd").val();
setCookie('username',username,365);
setCookie('password',password,365);
}
var evt = window.event?window.event:evt;
if(evt.keyCode==13)
{
document.forms["sub1"].submit();
}
};
function getCookie(c_name)
{
if (document.cookie.length>0)
{
c_start=document.cookie.indexOf(c_name + "=");
if (c_start!=-1)
{
c_start=c_start + c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if (c_end==-1) c_end=document.cookie.length;
return unescape(document.cookie.substring(c_start,c_end));
}
}
return "";
}
function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
function checkCookie()
{
username=getCookie('username');
password=getCookie('password');
if (username!=null && username!=""){
$("#account").val(username);
$("#pwd").val(password);
}
/* else
{
alert("没有cookie");
username=prompt('Please enter your name:',"");
username=$("#account").val();
password=$("#pwd").val();
if (username!=null && username!="")
{
setCookie('username',username,365);
setCookie('password',password,365);
}
} */
}
</script>
<style type="text/css">
.getacc{
margin-left: 22px;
margin-top: 30px;
}
.getemail{
margin-left: 22px;
margin-top: 10px;
}
body{
margin:0;
padding: 0;
MARGIN-RIGHT: auto; MARGIN-LEFT: auto;
}
#aaa{
width:1400px;
margin:0px auto;
border:1px solid;
height:900px;
MARGIN-RIGHT: auto; MARGIN-LEFT: auto;
background: url('pic/background.png') no-repeat;
}
</style>
</head>
<body onLoad="checkCookie()">
<div id="aaa" >
<form action="Loginnew!userLogin.action" method="post" id="sub1">
<div class="login" style="position: relative;">
<img alt="" src="pic/logo.png" id="loginlogo" width="314px" height="114px"><p><p><p>
<div style="top:142px;right: 590px;width: 396px;background-image: url('pic/text.png');background-repeat:no-repeat;
height: 50px;">
<img alt="" src="pic/user.png" style="padding-top: 10px;margin-left: 8px;"/>
<div id="usermove">
<input type="text" name="gameoperatorvo.account" id="account" onclick="clearmsg()" />
</div>
</div>
<p>
<div style="width: 396px;position: relative;background-image: url('pic/text.png');height:46px;
background-repeat:no-repeat;vertical-align: middle;margin-top: 50px;">
<img alt="" src="pic/pwd.png" style="padding-top: 10px;margin-left: 8px;"/>
<div id="pwdmove"><input type="password" name="gameoperatorvo.password" id="pwd" /></div>
<div id="logchage">
<a href="javascript:check()" >
<img alt="" src="pic/nolog.png" onmouseover="changeimgover()" onmouseout="changeimgout()" /></a>
</div>
</div>
<p>
<input type="checkbox" id="checkboxid"/>
<a>记住密码</a>
<a style="right: 290px;top:478px; cursor: pointer;margin-left: 180px;" id="show">忘记密码?</a>
<div >
</div>
<h2 id="msg">${message }</h2>
</div>
</form>
<form action="Loginaction!forgetpwd.action" method="post" id="sub2">
<div class="pop_box" id="pop">
<div style="font-size: 22px;font-family: 微软雅黑;font-weight: bold;position: absolute;margin-top: 8px;padding-left: 10px;">
<img alt="" src="pic/forgetpwdlogo.png">
</div>
<img alt="关闭" src="pic/close.png" title="关闭" id="close" style="cursor: pointer;padding: 6px 360px;"/>
<div style="position: absolute;margin-top: 42px;margin-left: 28px;">
<img alt="" src="pic/user.png" />
</div>
<input type="text" name="gameoperatorvo.account" id="accounthi" value="请输入账号"
style="padding-left: 40px;font-size: 20px;width: 318px;height: 41px;" onclick="clearmsg()" class="getacc"/><p>
<div style="position: absolute;margin-top: 24px;margin-left: 28px;">
<img alt="" src="pic/mail.png"/>
</div>
<input type="text" name="gameoperatorvo.email" id="pwdmov" class="getemail" value="输入预留邮箱"
style="padding-left: 40px;font-size: 20px;width: 318px;height: 41px;" onclick="clearmail()"/><p>
<div style="margin-left: 200px;position: absolute;top: 148px;left: 80px;">
<a href="javascript:checkmail()"><img alt="" src="pic/pwdok.png"></a>
</div>
<h2 id="Eerror">${message }</h2>
</div>
</form>
</div>
</body>
</html>
自己写的一个登陆记住账号密码小demo
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>游戏联运合作首页</title>
<LINK rel=stylesheet type=text/css href="css/index.css" />
<script type="text/javascript" src="./js/jquery-1.9.1.min.js"></script>
<script src="./js/jquery-1.9.1.js"></script>
<script src="./js/jquery-ui.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="./js/jqModal.js"></script>
<script type="text/javascript">
function checkmail(){
var a =$(".getemail").val();
if (a== "" || a.length == 0) {
$("#Eerror").css("color", "black");
$("#Eerror").html("请输入邮箱!");
return ;
} else {
var developEmailReg = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z_-]+)+$/;
if (!developEmailReg.test(a)) {
$("#Eerror").css("color", "black");
$("#Eerror").html("邮箱地址错误!");
return ;
}else{
$("#Eerror").html("");
$("#sub2").submit();
}
}
}
function changeimgover(){
$("#logchage").attr("src","pic/onlog.png");
}
function changeimgout(){
$("#logchage").attr("src","pic/nolog.png");
}
function check(){
/* var a =window.screen.height;
var b=window.screen.width; */
var che=document.getElementById("checkboxid");
if(che.checked){
username=$("#account").val();
password=$("#pwd").val();
setCookie('username',username,365);
setCookie('password',password,365);
}
$("#sub1").submit();
}
function clearmsg(){
$(".getacc").val("");
$(".getemail").val("");
$("#msg").html("");
}
function clearmail(){
$(".getemail").val("");
}
jQuery(document).ready(function() {
jQuery("#pop").jqm({
modal: true,
overlay: 30,
onShow: function(h) {
h.w.fadeIn(500);
},
onHide: function(h) {
h.o.remove();
h.w.fadeOut(500);
}
}).jqmAddClose("#close");
jQuery("#show").click(function() {
jQuery("#pop").jqmShow();
});
});
document.onkeydown = function(evt){
var che=document.getElementById("checkboxid");
if(che.checked){
username=$("#account").val();
password=$("#pwd").val();
setCookie('username',username,365);
setCookie('password',password,365);
}
var evt = window.event?window.event:evt;
if(evt.keyCode==13)
{
document.forms["sub1"].submit();
}
};
function getCookie(c_name)
{
if (document.cookie.length>0)
{
c_start=document.cookie.indexOf(c_name + "=");
if (c_start!=-1)
{
c_start=c_start + c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if (c_end==-1) c_end=document.cookie.length;
return unescape(document.cookie.substring(c_start,c_end));
}
}
return "";
}
function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
function checkCookie()
{
username=getCookie('username');
password=getCookie('password');
if (username!=null && username!=""){
$("#account").val(username);
$("#pwd").val(password);
}
/* else
{
alert("没有cookie");
username=prompt('Please enter your name:',"");
username=$("#account").val();
password=$("#pwd").val();
if (username!=null && username!="")
{
setCookie('username',username,365);
setCookie('password',password,365);
}
} */
}
</script>
<style type="text/css">
.getacc{
margin-left: 22px;
margin-top: 30px;
}
.getemail{
margin-left: 22px;
margin-top: 10px;
}
body{
margin:0;
padding: 0;
MARGIN-RIGHT: auto; MARGIN-LEFT: auto;
}
#aaa{
width:1400px;
margin:0px auto;
border:1px solid;
height:900px;
MARGIN-RIGHT: auto; MARGIN-LEFT: auto;
background: url('pic/background.png') no-repeat;
}
</style>
</head>
<body onLoad="checkCookie()">
<div id="aaa" >
<form action="Loginnew!userLogin.action" method="post" id="sub1">
<div class="login" style="position: relative;">
<img alt="" src="pic/logo.png" id="loginlogo" width="314px" height="114px"><p><p><p>
<div style="top:142px;right: 590px;width: 396px;background-image: url('pic/text.png');background-repeat:no-repeat;
height: 50px;">
<img alt="" src="pic/user.png" style="padding-top: 10px;margin-left: 8px;"/>
<div id="usermove">
<input type="text" name="gameoperatorvo.account" id="account" onclick="clearmsg()" />
</div>
</div>
<p>
<div style="width: 396px;position: relative;background-image: url('pic/text.png');height:46px;
background-repeat:no-repeat;vertical-align: middle;margin-top: 50px;">
<img alt="" src="pic/pwd.png" style="padding-top: 10px;margin-left: 8px;"/>
<div id="pwdmove"><input type="password" name="gameoperatorvo.password" id="pwd" /></div>
<div id="logchage">
<a href="javascript:check()" >
<img alt="" src="pic/nolog.png" onmouseover="changeimgover()" onmouseout="changeimgout()" /></a>
</div>
</div>
<p>
<input type="checkbox" id="checkboxid"/>
<a>记住密码</a>
<a style="right: 290px;top:478px; cursor: pointer;margin-left: 180px;" id="show">忘记密码?</a>
<div >
</div>
<h2 id="msg">${message }</h2>
</div>
</form>
<form action="Loginaction!forgetpwd.action" method="post" id="sub2">
<div class="pop_box" id="pop">
<div style="font-size: 22px;font-family: 微软雅黑;font-weight: bold;position: absolute;margin-top: 8px;padding-left: 10px;">
<img alt="" src="pic/forgetpwdlogo.png">
</div>
<img alt="关闭" src="pic/close.png" title="关闭" id="close" style="cursor: pointer;padding: 6px 360px;"/>
<div style="position: absolute;margin-top: 42px;margin-left: 28px;">
<img alt="" src="pic/user.png" />
</div>
<input type="text" name="gameoperatorvo.account" id="accounthi" value="请输入账号"
style="padding-left: 40px;font-size: 20px;width: 318px;height: 41px;" onclick="clearmsg()" class="getacc"/><p>
<div style="position: absolute;margin-top: 24px;margin-left: 28px;">
<img alt="" src="pic/mail.png"/>
</div>
<input type="text" name="gameoperatorvo.email" id="pwdmov" class="getemail" value="输入预留邮箱"
style="padding-left: 40px;font-size: 20px;width: 318px;height: 41px;" onclick="clearmail()"/><p>
<div style="margin-left: 200px;position: absolute;top: 148px;left: 80px;">
<a href="javascript:checkmail()"><img alt="" src="pic/pwdok.png"></a>
</div>
<h2 id="Eerror">${message }</h2>
</div>
</form>
</div>
</body>
</html>
自己写的一个登陆记住账号密码小demo
相关文章推荐
- 对于登陆等敏感信息,我们很多时候不希望浏览器记住账号或者密码
- 如何让git记住你的账号密码?不用每次push的时候都输入账号密码
- 模仿QQ记住账号和密码的登陆与实现的android开发实例
- asp.net登陆时候记住用户名密码
- Cookie记住登陆账号和密码
- cocos2d JS 本地缓存存储登陆记住账号密码->相当于C++中的UserDefault
- SharedPreference存储实战之记住登陆账号密码
- dede输入正确账号密码转向登陆时出现空白的问题分析
- 解决浏览器自动填充记住的账号密码问题
- 利用h5的本地存储实现登录页面里的记住账号和密码功能
- C#序列化实现用户登录记住账号密码功能
- android登陆记住密码
- Android实现带有记住密码功能的登陆界面
- 登录记住账号和密码小Demo
- ambari初始化登陆账号/密码假如不是admin/admin
- [HOWTO]xp下取消登陆网上邻居时默认"记住密码"的办法
- 忘记Django登陆账号和密码的处理方法
- 使用SharedPreferences记住账号密码
- 关于如何实现禁止浏览器记住账号、密码的功能
- 登录时记住账号密码功能示例代码