//判断密码是不是简单密码 function checkPWDifEasy(cardId,strPWD,strPhone,strMobile,strAccNo) { var strNum; var strString; //判断密码是不是小于6位 if(strPWD.length<6){ //alert("密码长度不够"); return false; } //判断是不是连续的升序数字 strNum="01234567890"; if(strNum.indexOf(strPWD)!=-1) { //alert("密码是连续的升序数字"); return false; } //判断是不是连续的降序数字 strNum="09876543210"; if(strNum.indexOf(strPWD)!=-1){ //alert("密码是连续的降序数字"); return false; } //判断是不是同样的数字或字母 for(var i=0;i=strPWD.length){ var strSize = parseInt(strPWD.length); var sPhone=strPhone.substring(strPhone.length-strSize) if(strPWD==sPhone){ //alert("是电话的后几位"); return false; } } } //判断密码是不是手机的后几位 if(strMobile!=null){ if(strMobile.length>=strPWD.length){ var strSize = parseInt(strPWD.length); var sMobile=strMobile.substring(strMobile.length-strSize); if(sMobile==strPWD){ //alert("是手机号的后几位"); return false; } } } //判断密码是不是账号的后几位 var strSize = parseInt(strPWD.length); var sAccNo= strAccNo.substring(strAccNo.length-strSize); if(strPWD==sAccNo){ //alert("是账号的后几位"); return false; } //判断密码是不是证件号码的后几位 if(cardId.length >=strPWD.length){ var temp = cardId.substring(cardId.length-strSize); if(strPWD==temp) { //alert("密码为证件的后几位"); return false; } } //判断密码是不是生日(身份证为15位) if(cardId.length==15){ if(strPWD.length==6){ var tempone=cardId.substring(6,12); if(strPWD==tempone) { //alert("密码为生日"); return false; } } } //判断密码是不是生日(身份证为18位) if(cardId.length==18){ if(strPWD.length==6){ var tempone= cardId.substring(8,14); if(strPWD==tempone) { //alert("密码不能为生日"); return false; } } if(strPWD.length==8){ var temptwo = cardId.substring(6,14); if(strPWD==temptwo) { //alert("密码为生日"); return false; } } } // added by tjh // 判断是否字母+数字组合 var patt1=/\d/; var patt2=/[a-z]/i; if( !( patt1.test(strPWD) && patt2.test(strPWD))){ return false; } return true; } //校验手机号码 function checkMobile(){ var mobileNum=document.jhform.MOBILE.value; if( mobileNum == null || mobileNum == ""){ alert("开通手机银行手机号码不能为空!"); document.jhform.MOBILE.focus(); return false; } if(mobileNum.length!=11){ alert("开通手机的手机号码错误!"); document.jhform.MOBILE.focus(); return false; } if(!isInt(mobileNum)){ alert("开通手机银行手机号码只能输入数字!"); document.jhform.MOBILE.focus(); return false; } return true; } //判断账号 function checkAccNo(){ var accNo = document.jhform.ACCNO.value; if(accNo==null||accNo==""){ alert("账号不能为空。"); document.jhform.ACCNO1.focus(); return false; } if(!isInt(accNo)){ alert("账号为数字。"); document.jhform.ACCNO1.focus(); return false; } if (accnoChange(accNo)) { alert("目前暂不支持信用卡开通手机银行。"); document.jhform.ACCNO1.focus(); return false; } /* if(document.getElementById("VALIDATE").value==""){ alert("请输入有效日期"); document.getElementById("VALIDATE").focus(); return false; } if(document.all.jhform.BANK.value==null||document.all.jhform.BANK.value==""){ alert("请选择分行"); document.all.jhform.BANK.focus(); return false; } if(document.all.jhform.BANK.value!=null||document.all.jhform.BANK.value!=""){ if(document.all.jhform.BBANK.value==null||document.all.jhform.BBANK.value==""){ alert("请选择二级分行"); document.all.jhform.BBANK.focus(); return false; } } document.all.jhform.BRANCHID.value = document.all.jhform.BANK.value; } */ return true; } //校验密码函数 function checkPwd(){ if (!checkAccPwd(document.jhform.ACCPWD.value)) { return false; } if(document.jhform.PT_CONFIRM_PWD==null||document.jhform.PT_CONFIRM_PWD.value ==""){ alert("请输入附加码。"); document.jhform.PT_CONFIRM_PWD.focus(); return false; } return true; } //判断账户密码 function checkAccPwd(accPwd){ accPwd=getStartPassword(accPwd); //var accNo = document.jhform.ACCNO.value; //var mobile= document.jhform.MOBILE.value;//手机号码; if(accPwd == null||accPwd == ""){ alert("账户密码不能为空。"); document.getElementById("ACCPWD").value=""; document.getElementById("ACCPWD").focus(); return false; } if (accPwd.length != 6) { alert("账户密码只能为6位的数字。"); document.getElementById("ACCPWD").value=""; document.getElementById("ACCPWD").focus(); return false; } if(!isInt(accPwd)){ alert("账户密码只能是数字。"); document.getElementById("ACCPWD").value=""; document.getElementById("ACCPWD").focus(); return false; } if(isAccPwdEasy(accPwd, "")){ alert("您输入的账户密码过于简单,请参考右侧“简单账户密码”规则。为保证您的资金安全,请更改账户密码后,再办理网上银行相关业务。"); document.getElementById("ACCPWD").value=""; document.getElementById("ACCPWD").focus(); return false; } return true; } // 验证收费标准是否输入,当手机号码为非移动时,不需要做此操作 function checkPayType() { var runCompany = document.getElementById("RUNCOMPANY").value; if (runCompany == "1") { if (document.getElementById("ACCPAY_TYPE").value == "") { alert("收费标准不能为空。"); return false; } } return true; } // 验证手机银行登录密码 function checkLogPwd() { var logPwd = getStartPassword(document.jhform.LOGPWD.value); var logPwdConf = getStartPassword(document.jhform.LOGPWDCONF.value); if (logPwd == "") { alert("登录密码不能为空。"); return false; } if (logPwd.length < 6) { alert("登录密码的长度不能小于6位。"); return false; } var patt1=/\d/; var patt2=/[a-z]/i; if( !( patt1.test(logPwd) && patt2.test(logPwd))){ alert("登录密码必须是字母和数字的组合。"); return false; } if(isMbsPwdEasy(logPwd, to$('IDNUMBER').value, to$('MOBILE').value, to$('ACCNO').value)) { alert('您设置的密码过于简单,请参考右侧“简单密码”规则,重新设置密码。'); return false; } if (logPwd != logPwdConf) { alert("两次输入的登录密码不一致。"); return false; } return true; } //检验是否数字 function isInt(strNum){ return (!isNaN(strNum) && strNum.indexOf(".") == -1); } String.prototype.endWith = function(str) { if(str==null||str==""||this.length==0||str.length>this.length) return false; if(this.substring(this.length-str.length)==str) return true; else return false; return true; } String.prototype.startWith = function(str) { if(str==null||str==""||this.length==0||str.length>this.length) return false; if(this.substr(0,str.length)==str) return true; else return false; return true; } function isMbsPwdEasy(pwd, idNum, mobNo, accNo) { var plen = pwd.length; var mapSet = {}; for (var i =0; i < plen; i++) { mapSet[pwd.charAt(i)] = 'HashSet'; } var kindsSize = 0; for (var i in mapSet) { kindsSize++; } if (kindsSize < 2) { // 相同的情况 rule: 1 return true; } var strNum = '0123456789'; if (strNum.indexOf(pwd) != -1) { // rule: 2 return true; } strNum = '9876543210'; if (strNum.indexOf(pwd) != -1) { // rule: 2 return true; } strNum = 'abcdefghijklmnopqrstuvwxyz'; if (strNum.indexOf(pwd) != -1) { // rule: 2 return true; } strNum = 'zyxwvutsrqponmlkjihgfedcba'; if (strNum.indexOf(pwd) != -1) { // rule: 2 return true; } strNum = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; if (strNum.indexOf(pwd) != -1) { // rule: 2 return true; } strNum = 'ZYXWVUTSRQPONMLKJIHGFEDCBA'; if (strNum.indexOf(pwd) != -1) { // rule: 2 return true; } strNum = '00112233445566778899'; if (strNum.indexOf(pwd) !=-1 && plen % 2 == 0 && plen/2 == kindsSize) { // rule: 3 return true; } strNum = '99887766554433221100'; if (strNum.indexOf(pwd) != -1 && plen % 2 == 0 && plen/2 == kindsSize) { // rule: 3 return true; } strNum = '000111222333444555666777888999'; if (strNum.indexOf(pwd) != -1 && plen % 3 == 0 && plen/3 == kindsSize) { //rule: 4 return true; } strNum = '999888777666555444333222111000'; if (strNum.indexOf(pwd) != -1 && plen % 3 == 0 && plen/3 == kindsSize) { // rule: 4 return true; } if(plen == 6 || plen == 8){ if(idNum.length == 18){ var temp = idNum.substring(6,14); if(temp.startWith(pwd) || temp.endWith(pwd)){ return true; } } else if(idNum.length == 15){ var temp = '19' + idNum.substring(6,12); if(temp.startWith(pwd) || temp.endWith(pwd)){ return true; } } } if (idNum.endWith(pwd)) { return true; } if (mobNo.endWith(pwd)) { return true; } if (accNo.endWith(pwd)) { return true; } return false; }