密码强度检测函数(正则)

 密码强度检测函数(正则)
本文来自: 脚本之家(www.jb51.net) 详细出处参考:http://www.jb51.net/article/591.htm

 

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>OA登录</title>
<style type="text/css">
<!--
td {
 font-size: 12px;
 color: #FFFFFF;
 text-decoration: none;
}
input {
 font-size: 12px;
 color: #003399;
 text-decoration: none;
 background-color: #EFF1F5;
 border: 1px solid #427CD5;
}
.style2 {color: #efefef}
-->
</style>
<SCRIPT>
function showImage(){
var imgObj=new Image(); //创建一个Image对象
imgObj.src="http://www.beingmate.com/images/banner_chang_add.gif"; //装载Image源
if(typeof(imgObj)=="object"){ //判断imgObj装载过后是否为对象,防止异常操作
var width=0;
var height=0;
width=imgObj.width+20; //+20是因为IE方式的默认边距
height=imgObj.height+20;
if(width!=0&&height!=0){
window.open(imgObj.src,"Imagehow", "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=" +( width )+ ",height=" +( height));
}else{
setTimeout("showImage()", 100); // 判断图片是否装载完成,只有在装载完成后才能取到宽高值
}
}else{
alert("系统错误");
}
}
//showImage();
</SCRIPT>
<script type="text/javascript">
//From BBS.51JS.COM By 网络东西
var $ = function(v){return document.getElementById(v);}
function isSecurity(v){
 if (v.length < 3) { iss.reset();return;}
 var lv = -1;
 if (v.match(/[a-z]/ig)){lv++;}
 if (v.match(/[0-9]/ig)){lv++;}
 if (v.match(/(.[^a-z0-9])/ig)){lv++;}
 if (v.length < 6 && lv > 0){lv--;}
 iss.reset();
 switch(lv) { 
 case 0:
 iss.level0();
 break;
 case 1:
 iss.level1();
 break;
 case 2:
 iss.level2();
 break;
 default:
 iss.reset();
 }
}
var iss = {
 color:["CC0000","FFCC33","66CC00","CCCCCC"],
 text:["弱","中","强"],
 width:["50","100","150","10"],
 reset:function(){
 $("B").style.backgroundColor = iss.color[3];
 $("B").style.width = iss.width[3];
 $("A").innerHTML = "";
 },
 level0:function(){
 $("B").style.backgroundColor = iss.color[0];
 $("B").style.width = iss.width[0];
 $("A").innerHTML = "密码较弱"; 
 },
 level1:function(){
 $("B").style.backgroundColor = iss.color[1];
 $("B").style.width = iss.width[1];
 $("A").innerHTML = "中"; 
 },
 level2:function(){
 $("B").style.backgroundColor = iss.color[2];
 $("B").style.width = iss.width[2];
 $("A").innerHTML = "高强";
 }
}
</script>
<style type="text/css">
<!--
.font14 {
 font-family: "Arial", "Helvetica", "sans-serif";
 font-size: 14px;
 font-weight: bold;
}
-->
</style>
</head>

<body background="BG.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td align="center"> 
      <table width="500" border="0" cellpadding="0" cellspacing="2" bgcolor="#427CD5">
        <tr>
          <td><table width="600" height="350" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
              <tr> 
                <td valign="top" background="bg.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width="13%" height="126"> </td>
                      <td width="87%"> </td>
                    </tr>
                    <tr> 
                      <td> </td>
                      <td align="right"><div align="left"> <span class="font14"><a href="http://www.beingmate.com/user_login/" target="_blank"><font color="#FF3300">贝因美冠军宝贝大赛专用信息平台入口</font></a></span> 
                          <p align="center"><font color=#ff0000>用户名或密码错误,请重新输入。</font>
<form name="loginform" method="post" action="Main.asp" target="_parent">
  <div align="left"></div>
  <table border=0 width="55%" cellspacing=1 cellpadding=3>
    <tr> 
      <td width="25%" align=right>帐号/编号:</td>
      <td width="25%"><input name=LoginName type=text size=10 maxlength=20 class="doc_txt" value=""></td>
      <td align=right>密码: <input name="Pwd" type="Password" size=10 maxlength=20 class="doc_txt" value="" οnkeyup="isSecurity(this.value);"></td>
    </tr>
    <tr> 
      <td height="50" colspan="3" align=right><div align="center">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="36%" align="right"><font class="red" id="A">密码强度检测</font> </td>
            <td width="64%" valign="top">
<table height="8" border="1" align="left" cellpadding="0" cellspacing="0" bordercolor="#EEEEEE" style="border-collapse:collapse;">
<tr>
 <td bgcolor="#EEEEEE" width="1" align="center" valign="middle" id="B"></td>
</tr>
</table></td>
          </tr>
        </table>
        
 
      <table width="180" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="83" align="right"><label>
            <input type="submit" name="Submit" value=" 登 陆 " οnclick="return CheckData();"/>
          </label>
              </td>
                <td width="97" align="center"><a href="USER/REG.ASP" target="_blank"><font color="#FFFFFF">申请OA帐号</font></a></td>
            </tr>
        <tr align="right"> 
          <td colspan="2">  </td>
            </tr>
        </table>
            <input name="login_auto" type="checkbox" id="login_auto" value="1" >
        打勾后表示下次自动登陆
 
  <marquee behavior="scroll" scrollamount="3" direction="left" width="150">
    <font color="#FFFFFF"></font> 
    </marquee>
       
 
      </div></td>
    </tr>
  </table>
  <div align="left"></div>
</form>

<script language=javascript>
function CheckData()
{
 if(jtrim(document.loginform.LoginName.value)=="")
 {
  alert("请输入登录用户名。")
  document.loginform.LoginName.focus();
  return false;
 }
 if(jtrim(document.loginform.LoginName.value).length>100)
 {
  alert("登录用户名不能超过100个字。")
  document.loginform.LoginName.focus();
  return false;
 }
  
 return true;
}
</script>
<script language=javascript src="inc/jtrim.js"></script>
                        
                      </div></td>
                    </tr>
                  </table>
                  <div align="right"><a href="http://2006.babyschool.com.cn
" target="_blank"><span class="font14"><font color="#FFFFFF">2006贝因美冠军宝贝大赛省级晋级赛进行时 </font></span></a><a href="http://oa.beingmate.com/help/" target="_blank"><font color="#EFEFEF">
 
                   
 
                    帮助文档</font></a> <a href="feedback.asp" target="_blank"><font color="#EFEFEF">意见反馈</font></a><span class="font14"><font color="#EFEFEF"> 
                     </font></span><a href="http://oa.beingmate.com/help/" target="_blank"><font color="#EFEFEF"></font></a>
 
                    <font color="#0061CE"> 
                    222.212.7.171
                   </span> </font> </div></td>
              </tr>
            </table></td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>

-------------------------------------------------------------------

 

 
 
 
 
 
<script> 
function showImage(){ 
var imgObj=new Image(); //创建一个Image对象 
imgObj.src="http://www.beingmate.com/images/banner_chang_add.gif"; //装载Image源 
if(typeof(imgObj)=="object"){ //判断imgObj装载过后是否为对象,防止异常操作 
var width=0; 
var height=0; 
width=imgObj.width+20; //+20是因为IE方式的默认边距 
height=imgObj.height+20; 
if(width!=0&&height!=0){ 
window.open(imgObj.src,"Imagehow", "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=" +( width )+ ",height=" +( height)); 
}else{ 
setTimeout("showImage()", 100); // 判断图片是否装载完成,只有在装载完成后才能取到宽高值 
} 
}else{ 
alert("系统错误"); 
} 
} 
//showImage(); 
</script> 
<script type=text/javascript> 
//From BBS.51JS.COM By 网络东西 
var $ = function(v){return document.getElementById(v);} 
function isSecurity(v){ 
 if (v.length < 3) { iss.reset();return;} 
 var lv = -1; 
 if (v.match(/[a-z]/ig)){lv++;} 
 if (v.match(/[0-9]/ig)){lv++;} 
 if (v.match(/(.[^a-z0-9])/ig)){lv++;} 
 if (v.length < 6 && lv > 0){lv--;} 
 iss.reset(); 
 switch(lv) {  
 case 0: 
 iss.level0(); 
 break; 
 case 1: 
 iss.level1(); 
 break; 
 case 2: 
 iss.level2(); 
 break; 
 default: 
 iss.reset(); 
 } 
} 
var iss = { 
 color:["CC0000","FFCC33","66CC00","CCCCCC"], 
 text:["弱","中","强"], 
 width:["50","100","150","10"], 
 reset:function(){ 
 $("B").style.backgroundColor = iss.color[3]; 
 $("B").style.width = iss.width[3]; 
 $("A").innerHTML = ""; 
 }, 
 level0:function(){ 
 $("B").style.backgroundColor = iss.color[0]; 
 $("B").style.width = iss.width[0]; 
 $("A").innerHTML = "密码较弱";  
 }, 
 level1:function(){ 
 $("B").style.backgroundColor = iss.color[1]; 
 $("B").style.width = iss.width[1]; 
 $("A").innerHTML = "中";  
 }, 
 level2:function(){ 
 $("B").style.backgroundColor = iss.color[2]; 
 $("B").style.width = iss.width[2]; 
 $("A").innerHTML = "高强"; 
 } 
} 
</script> 
 
 

 

 
 
贝因美冠军宝贝大赛专用信息平台入口

用户名或密码错误,请重新输入。

帐号/编号:密码:
密码强度检测
申请OA帐号
打勾后表示下次自动登陆
<script language=javascript> function CheckData() { if(jtrim(document.loginform.LoginName.value)=="") { alert("请输入登录用户名。") document.loginform.LoginName.focus(); return false; } if(jtrim(document.loginform.LoginName.value).length>100) { alert("登录用户名不能超过100个字。") document.loginform.LoginName.focus(); return false; } return true; } </script><script language=javascript src="inc/jtrim.js"></script>
本文来自: 脚本之家(www.jb51.net) 详细出处参考:http://www.jb51.net/article/591.htm
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值