<%@page contentType="text/html;charset=utf-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户登录</title>
<style type="text/css">
.login{
font-family:宋体;
font-size:12px;
}
.login td{
height:30px;
}
.align{font-size:12px;}
.align input{display:block;}
.align span{display:block; margin-left:22px!important; margin-left:11px; margin-top:-16px; float:left; height:16px; line-height:14px;}
</style>
</head>
<script type="text/javascript">
document.onkeydown=ShortcutKey;
function ShortcutKey(){
if(window.event.keyCode==13) {
submitForm();
}
}
function submitForm() {
if (document.getElementById("optorId").value == "") {
alert("用户名必须填写!");
document.getElementById("optorId").focus();
return false;
} else {
if(document.getElementById('saveLoginPwd').checked==true){
setCookie("officeLoginName",document.getElementById('optorId').value);
setCookie("officeLoginType",document.loginForm.loginType.value);
setCookie("officeLoginPwd",document.getElementById('pwd').value);
}else if(document.getElementById('saveLoginName').checked==true){
setCookie("officeLoginName",document.getElementById('optorId').value);
setCookie("officeLoginType",document.loginForm.loginType.value);
delCookie("officeLoginPwd");
}else{
delCookie("officeLoginName");
delCookie("officeLoginType");
delCookie("officeLoginPwd");
}
document.loginForm.submit();
}
}
function loadWindow() {
if(document.getElementById('optorId').value==""){
var officeLoginName=getCookie("officeLoginName");
var officeLoginType=getCookie("officeLoginType");
var officeLoginPwd=getCookie("officeLoginPwd");
if(officeLoginName!=null&&officeLoginName!=""&&officeLoginName!="null"){
document.getElementById('optorId').value=officeLoginName;
document.getElementById('saveLoginName').checked=true
}
if(officeLoginType!=null&&officeLoginType!=""&&officeLoginType!="null"){
document.loginForm.loginType.value=officeLoginType;
}
if(officeLoginPwd!=null&&officeLoginPwd!=""&&officeLoginPwd!="null"){
document.getElementById('pwd').value=officeLoginPwd;
document.getElementById('saveLoginPwd').checked=true
}
}
document.loginForm.elements["optorId"].focus();
}
function setCookie(name,value) {
var exp = new Date("December 31, 9998");
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
function getCookie(name){
var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
if(arr != null) return unescape(arr[2]); return null;
}
function delCookie(name){
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval=getCookie(name);
if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}
window.onload=loadWindow;
</script>
<body style="background-color:#C0C0C0; padding:0;margin:0;">
<div style="margin:0 auto; width:1002px;position: relative;"><img src="<%=com.officeFrame.app.App.webUrl%>/appfiles/aicu/imgs/bj.jpg" border="0">
<div style="width:300px; height:160px;position: absolute;top:220px;left:580px; ">
<form action="<%=com.officeFrame.app.App.webUrl%>/optorLogin_login.so" method="post" name="loginForm" class="loginform" onsubmit="submitForm();">
<input type="hidden" id="returnUrl" name="returnUrl" value="<%=WebUtils.getParameter(request, "returnUrl")%>" />
<table class="align login" width="100%" >
<tr>
<input type="hidden" name="loginType" value="01">
<td width="25%" align="right">用户名:</td>
<td width="40%" ><input type="text" style="width:130px;height:14px;" id="optorId" name="optorId" maxlength="30" value="<%=WebUtils.getParameter(request, "optorId")%>" /></td>
<td width="35%"align="left"><input type="checkbox" name="saveLoginName" id="saveLoginName" value="1" /><span>记住登录名</span></td>
</tr>
<tr>
<td align="right">密 码:</td>
<td><input type="password" style="width:130px;height:14px;" name="pwd" id="pwd" maxlength="20" /></td>
<td><input type="checkbox" name="saveLoginPwd" id="saveLoginPwd" value="1" /><span>记住密码</span></td>
</tr>
<tr>
<td style="height:10px;"></td>
</tr>
<tr>
<td colspan="3" align="center">
<img onclick="submitForm();" src="<%=com.officeFrame.app.App.webUrl%>/appfiles/aicu/imgs/dl1.jpg" border="0">
<img onclick="loginForm.reset();" src="<%=com.officeFrame.app.App.webUrl%>/appfiles/aicu/imgs/cz1.jpg" border="0">
</td>
</tr>
</table>
</form>
</div>
<div style="color:#FFFFFF;font-size:12px;position: absolute;top:530px;left:370px;">亚信联创科技(中国)有限公司 版权所有 法律公告</div>
</div>
</body>
</html>
分享到:
相关推荐
cookie实现记住用户名密码(IntelliJ IDEA+tomcat)完整项目代码
用户登录功能、同时记住用户名密码,通过复选框勾选和不勾选实现记住、清除cookie中用户名密码等。
利用js+Cookie实现的记住用户名、密码功能,简单、实用、无后台繁琐代码,新手亦可看懂。
使用ASP.NET建站时,登录模块中常用的技术,解决了客户重复输入的用户名和密码比较麻烦的问题,实用性很强。
很好用,可在服务器端记住用户名密码,修改COOKIE轻松搞定
勾选复选框时,记住用户名和密码,下次就不用输入用户名和密码,点击登录即可直接登录到成功页面
里面详细记述了如何保持用户登录状态 记住用户名和密码多长时间 非常好用
主要介绍了通过jquery.cookie.js实现记住用户名、密码登录功能,通过Cookies让网站服务器把少量数据储存到客户端的硬盘或内存,从客户端的硬盘读取数据的一种技术;具体实现过程大家通过本文一起看看吧
jQuery之Cookie用法:记住用户名和密码实例,已打包为demo,欢迎大家下载(最火软件站)。 jquery中实现cookie的操作相比js要简单很多 操作步骤如下 1、引入JS文件(下载包中已包含) jquery-1.7.1.js jquery.cookie...
实现一个登录页面,如果用户复选记住用户名、密码,则下次访问页面时,将会自动在用户名、密码字段填入上次登录时所使用的值。
记住这些信息,可以使用Cookie来实现,更多Cookie应用,可参考http://jb51.net/article/33590.htm http://jb51.net/article/33591.htm现在我们来模拟一个登录介面: 代码如下: <table> <tr> <td xss=removed> User ...
主要介绍了php使用cookie实现记住用户名和密码实现代码,本文直接给出实现代码,需要的朋友可以参考下
今天小编就为大家分享一篇关于使用jquery的cookie实现登录页记住用户名和密码的方法,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编来看看吧
有的时候做网站,登录一次就需要勾选【记住自己复选框】记住用户登录信息,下次再登录网站时,不用重复输入用户名和密码,原理是浏览器的cookie把状态给记住了!
主要介绍了java web中使用cookie记住用户的账号和密码的相关资料,需要的朋友可以参考下
cookie是一种WEB服务器通过浏览器在访问者的硬盘上存储信息的手段。Cookie的目的就是为用户带来方便,为网站带来增值。这篇文章主要介绍了JavaWeb 中Cookie实现记住密码的功能示例,需要的朋友可以参考下
js操作cookie,记住用户名,密码。