本帖最后由 antony410 于 2014-4-25 22:30 编辑
是内网来的。
网页如果用户名或口令输错,提交后,网页提示"口号密码不正确".
想表单提交后,如果输错则退出。没有错,则执行后续的代码。
网页如何判断登录不成功?
如下图:
网页源代码
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" class="of">
<head>
<base href="http://oa.cn******.com:80/portal/root/login.jsp">
<meta name="keywords" content="" />
<meta name="description" content="" />
<title>欢迎访问**内部门户</title>
<link rel="shortcut icon" href="/portal/RES/css/images/favicon.ico" type="image/x-icon" />
<script src="http://oa.cn******.com/infoResource/news/portal/soaNST/soaNST3/js/jquery.js"></script>
<link type="text/css" href="http://oa.cn******.com/infoResource/news/portal/soaNST/soaNST3/login/css/common.css" rel="stylesheet">
<link type="text/css" href="http://oa.cn******.com/infoResource/news/portal/soaNST/soaNST3/login/css/login.css" rel="stylesheet">
<script src="http://oa.cn******.com/infoResource/news/portal/soaNST/soaNST3/login/js/soa_login.js" type="text/javascript"></script>
<style>
.soa-login-bg{ _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://oa.cn******.com/infoResource/news/portal/soaNST/soaNST3/login/css/images/soalogin_bg.png');}
/*弹出框*/
.extra-info,.extra-info-3,.extra-info-4,.extra-info-6,.extra-info-14,.extra-info-15,.extra-info-17{display:none;position:absolute;left:50%;margin-left:-239px;width:176px;
padding-top:6px;z-index:99999;overflow:hidden}
.extra-info-bg{position:absolute;left:0;top:0;width:100%;height:9999px;background:#000;opacity:0.3;filter:Alpha(opacity=30);}
.extra-info-box{position:relative;margin:0 6px 6px 6px;background:#fff;overflow:hidden;}
.extra-info-title{height:31px;border-bottom:1px solid #CECECE;background:#f0efef;}
.extra-info-title h3{padding-left:10px;line-height:32px;font-size:14px;font-weight:700;}
.extra-info-cont{position: relative; /*padding:10px 20px;*/ text-align: center; padding:16px 0;}
b.close{ position:absolute; display:block; height:15px; width:15px; cursor:pointer; right:15px; top:18px; background:url(../RES/soaNewStyle/original/login/css/images/close-x.png) no-repeat left top;}
#grayLayer {background:#000000;display: none;left: 0;opacity: 0.3;filter:Alpha(opacity=30);position: absolute;top: 0;z-index: 11000;}
.load_yun { position:relative; top:2px; left:6px; color:#0081CC;}
.load_yun:hover { color:#0081CC;}
</style>
<script>
function submit_form() {
if (document.form1.j_username.value == ""){
document.getElementById("error").innerHTML = "工号不能为空";
document.getElementById("error").style.display = "block";
document.form1.j_username.focus();
return false;
}
if (document.form1.j_password.value == ""){
document.getElementById("error").innerHTML = "密码不能为空";
document.getElementById("error").style.display = "block";
document.form1.j_password.focus();
return false;
}
rememberUserName();
}
document.onkeydown = function(event) {
var e = window.event || event;
if(e.keyCode == 13) {
submit_form();
}
}
function loaderror(){
var msg = "WRONGPASSWORD";
if('NOSUCHUSER' == msg){
document.getElementById("error").innerHTML = '该用户不存在,解决方案详见帮助';
document.getElementById("error").style.display = "block";
}else if ('WRONGPASSWORD' == msg){
document.getElementById("error").innerHTML = '工号或密码不正确,解决方案详见帮助';
document.getElementById("error").style.display = "block";
}else if ('LDAPLOSED' == msg){
document.getElementById("error").innerHTML = '长时间未操作,用户信息失效,请重新登入';
document.getElementById("error").style.display = "block";
}
//增加页面加载获取绑定关系
var value = $("#j_username").val();
getEmployeeBind(value);
//增加onchange事件;
$("#j_username").change( function() {
var juserVal = $(this).val();
getEmployeeBind(juserVal);
});
}
function rememberUserName(){
var re=/^[0-9]{0,}$/;
var employeeName = document.form1.j_username.value;
if(!re.test(employeeName)){
document.getElementById("error").innerHTML = "工号只能为8位数字";
document.getElementById("error").style.display = "block";
document.form1.j_username.focus();
return false;
}
var flag = "0";
if($(".remember i").hasClass("on")){
flag = "1";
}
$.ajax( {
url : "/portal/rememberUserName.htm",
type : "post",
cache : false,
async : true,
data : {"employeeName":employeeName,"flag":flag},
success : function(data) {
if(data=="1"){
document.form1.submit();
}
}
});
}
function getEmployeeBind(juserVal){
if("" == juserVal){
$("#snyl").hide();
$("#j_snyl_type").val("0");
}
$.ajax( {
url : "/portal/snyl/queryBindEmployee.htm",
type : "post",
cache : false,
async : true,
data : {"employeeId":juserVal
},
success : function(data) {
if("E" != data){
//document.form1.style.marginTop="-20px";
$("#snyl").show();
$("#j_snyl_type").val("1");
}else{
//document.form1.style.marginTop="0px";
$("#snyl").hide();
$("#j_snyl_type").val("0");
}
}
});
}
</script>
</head>
<body class="gray-bg of" onload="loaderror()">
<div id="body" class="body">
<script type="text/javascript">
(function(){
var _Dwarf = screen.height < 800,
_loginHeight = 340,
_wrap = document.getElementById('body');
if(_Dwarf) {
_wrap.style.backgroundPosition = "center -24px";
}
load_pad();
window.onresize = load_pad;
function load_pad(){
var _temp = 0, _bodyHeight = document.documentElement.clientHeight;
if(_bodyHeight > _loginHeight){
temp = (_bodyHeight-_loginHeight)/2 ;
if(_Dwarf) {
temp += (temp <= 120 ? 28 : 0);
}
} else {
temp = 0;
}
_wrap.style.paddingTop = temp + "px" ;
}
})();
</script>
<!-- 登陆界面[[-->
<div class="soa-login-bg">
<div class="soa-login">
<!--http://oa.cn******.com:80/******UUMWeb/AuthenticationServlet ../j_security_check-->
<form name="form1" style="margin: -15px" method="post" action="http://oa.cn******.com:80/******UUMWeb/AuthenticationServlet">
<input type="hidden"
name="UUM_SYSTEM" value="UWPPORTAL" /> <input type="hidden"
name="UUM_COMPANYCODE"
value="oa.cn******.com" />
<input id="j_snyl_type" name="j_snyl_type" type="hidden" value="0" />
<table>
<tr height="20"><td> </td><td><span id="error" style="display:none;" class="c-red ml5"></span></td></tr>
<tr height="40"><td><label>用户名:</label></td><td><span class="uText login-text user"><em></em><input name="j_username" id="j_username" type="text" value=""/></span></td></tr>
<tr height="40"><td><label>密<i class="w16"></i>码:</label></td><td><span class="uText login-text password"><em></em><input name="j_password" type="password" value="" /></span>
</td></tr>
<tr height="70"><td> </td><td><a style="cursor: pointer" onclick="submit_form()" class="u-btn"><span>登 录</span></a><span class="remember"><i ></i>记住用户名</span>
<p class="links"><a href="/portal/changePss/changePssStep.htm">忘记密码</a>
<a href="/portal/loginForHelp/redirectToHelp.htm">帮助</a></p></td></tr>
</table>
</form>
</div>
</div>
<!--]]登陆界面 -->
</div>
<!-- 弹出框 -->
<div class="winctrl extra-info-6">
<div class="extra-info-bg"></div>
<div class="extra-info-box">
<div class="extra-info-title">
<h3></h3>
</div>
<div class="extra-info-cont">
<p><img src="../RES/soaNewStyle/original/login/css/images/QuickMark.png" width="113" height="113" /></p>
</div>
</div>
<b class="close closepopW"></b>
</div>
<div id="grayLayer">
<iframe style="position:absolute;top:-5px;left:0;border:none;width:100%;height:100%;background:#666666;filter:alpha(opacity=0);" ></iframe>
</div>
<script>
$(function(){
function popup(obj,cObj,popObj,boolLocalCenter,boolLayer){
var popTarget = obj;
popTarget.click(function(){
//打开关闭遮罩层
function grayLayerAction(bool){
var grayLayer = $("#grayLayer");
if(bool){
grayLayer.css({display:"block",width:$(window).width()+"px",height:$(document).height()+"px"});
}else{
grayLayer.hide();
}
}
//打开弹出框
function openWin(obj1,boolC){
obj1.show();
if(boolC){ //1居中显示
obj1.css({top:($(window).height()-obj1.height())/2+$(window).scrollTop()+"px"});
}else{ //0跟随显示
obj1.css({top:obj.offset().top-obj1.height()-5+"px",left:obj.offset().left+"px",marginLeft:0});
}
}
//关闭弹出框
function closeWin(obj2){
obj2.hide();
grayLayerAction(false);
}
grayLayerAction(boolLayer);
openWin(popObj,boolLocalCenter);
//关闭
cObj.click(function(obj2){
closeWin(popObj);
});
$(window).resize(function(){
var ncw = document.documentElement.scrollLeft+document.documentElement.clientWidth;
$("#grayLayer").width(ncw);
})
})
function CloseWebPop(){$(".winctrl").hide();$("#grayLayer").hide();}
}
popup($("#load_yun"),$(".closepopW"),$(".extra-info-6"),0,0);
});
</script>
</body>
</html>
|