CSS:检验密码安全性等级

803次阅读
没有评论

<code><html><style type=text/css>
    body {<br />
    font-size: 12px;<br />
    font-family: Tahoma, Arial;<br />
    background: #C4C8CB;<br />
    margin: 0px;<br />
    padding: 0px;<br />
    }<br />
    td {<br />
    padding-left: 5px;<br />
    font-size: 12px;<br />
    font-family: Tahoma, Arial;<br />
    }<br />
    .blueFont {color: #6699CC}<br />
    .redFont {color: #FF0000}<br />
    /***** Other Elements in Page Content *****/<br />
    .pwd-strength {<br />
    padding: 2px;<br />
    padding-left: 5px;<br />
    padding-right: 5px;<br />
    width: 180px;<br />
    border: solid 1px #CCCCCC;<br />
    }<br />
    .pwd-strength-box,<br />
    .pwd-strength-box-low,<br />
    .pwd-strength-box-med,<br />
    .pwd-strength-box-hi<br />
    {<br />
    color: #464646;<br />
    text-align: center;<br />
    width: 33%;<br />
    }<br />
    .pwd-strength-box-low<br />
    {<br />
    color: #990000;<br />
    background-color: #FFECEC;<br />
    }<br />
    .pwd-strength-box-med<br />
    {<br />
    color: #000066;<br />
    background-color: #D2E9FF;<br />
    }<br />
    .pwd-strength-box-hi<br />
    {<br />
    color: #003300;<br />
    background-color: #DDFFDD;<br />
    }<br />
    </style>

<script language=javascript>
    function checkPassword(pwd){
    var objLow=document.getElementById("pwdLow");
    var objMed=document.getElementById("pwdMed");
    var objHi=document.getElementById("pwdHi");
    objLow.className="pwd-strength-box";
    objMed.className="pwd-strength-box";
    objHi.className="pwd-strength-box";
    if(pwd.length<6){
    objLow.className="pwd-strength-box-low";
    }else{
    var p1= (pwd.search(/&#91;a-zA-Z&#93;/)!=-1) ? 1 : 0;
    var p2= (pwd.search(/&#91;0-9&#93;/)!=-1) ? 1 : 0;
    var p3= (pwd.search(/&#91;^A-Za-z0-9_&#93;/)!=-1) ? 1 : 0;
    var pa=p1+p2+p3;
    if(pa==1){
    objLow.className="pwd-strength-box-low";
    }else if(pa==2){
    objMed.className="pwd-strength-box-med";
    }else if(pa==3){
    objHi.className="pwd-strength-box-hi";
    }
    }
    }
    </script>
<table border="1" width="400" cellspacing="0" cellpadding="0" align="center" bgcolor="#ffffff">
<tbody>
<tr>
<td colspan="2" align="middle" bgcolor="#ffffcc" height="22"><span class="blueFont"><b>校验密码安全性</b></span></td>
</tr>
<tr>
<td style="width: 100px;">请输入密码:</td>
<td><input name="password" type="password" value="" /></td>
</tr>
<tr>
<td style="width: 100px;">安全性等级:</td>
<td>
<table class="pwd-strength FCK__ShowTableBorders" width="100%" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td id="pwdLow" class="pwd-strength-box">低</td>
<td id="pwdMed" class="pwd-strength-box">中</td>
<td id="pwdHi" class="pwd-strength-box">高</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td colspan="2"><span class="redFont">建议至少 6 个字符. 请使用强密码以保证安全.</span></td>
</tr>
</tbody>
</table></html></code></pre>

正文完
 
正安一片瓦
版权声明:本站原创文章,由 正安一片瓦 2006-06-30发表,共计924字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)
验证码