<div class="codetitle"> <span><a style="CURSOR: pointer" data="25950" class="copybut" id="copybut25950" onclick="doCopy('code25950')"><u>코드 복사</u></a></span> 코드는 다음과 같습니다.</div> <div class="codebody" id="code25950"> <br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" ><br><html xmlns="http://www.w3.org/1999/xhtml"><br><br><head><br> <meta http-equiv="Content- Type" content="text/html; charset=gb2312" /><br> <title><br> 密码强島检测<br> </title><br> <style type="text/css" ><br> body{font:12px/1.5 Arial;} 입력{float:left;font-size:12px;width:150px;font-family:arial;border:1px<br> solid #ccc;padding:3px ;} 입력.수정{테두리:1px 단색 녹색;} 입력.오류{테두리:1px<br> 빨간색으로 켜짐;} #tips{float:left;margin:2px 0 0 20px;} #팁 범위{float:left; width:50px;height:20px;color:#fff;overflow:hidden; background:#ccc;margin-right:2px;line-height:20px;text-align:center;}<br> #tips.s1 .active {배경:#f30;} #tips.s2 .active{배경:#fc0;} #tips.s3<br> .active{배경:#cc0;} #tips.s4 .active{배경:#090;}<br> </style><br> <script type="text/javascript"><br> window.onload = function() {<br> var oTips = document.getElementById("tips");<br> var oInput = document.getElementsByTagName("input")[0];<br> var aSpan = oTips.getElementsByTagName("span");<br> var aStr = ["弱", "中", "强", "비常好"];<br> var i = 0;<br><br> oInput.onkeyup = oInput.onfocus = oInput.onblur = function() {<br> var index = checkStrong(this.value);<br> this.className = index ? "올바른": "오류";<br> oTips.className = "s" index;<br> for (i = 0; i < aSpan.length; i ) aSpan[i].className = aSpan[i]. innerHTML = "";<BR> index && (aSpan[index - 1].className = "active", aSpan[index - 1].innerHTML = aStr[index - 1])<BR> }<BR> };<BR> /** 强島规则<BR> --------------------------- ---------------- <---- ----> 1) 任何少于 6 个字符的组合 个字符的组合, 弱;任何字符数的同类字符组合 弱;任何字符数的同类字符组合, 弱; <BR> 2) 任何字符数的两类字符组合,中;<BR> 3) 12位字符数以下的三类或四类字符组合,强;<BR> 4) 12位字符数以上的 3类或四类字符组合,不常好。<BR> > // 비밀번호 강도 감지 <BR> Function Checkstrong (SVALUE) {<BR> VAR MODES = 0 <BR> IF (SVALUE. LENGTH & LT; 6 ) 반환 모드; //대문자 <BR> if (/W/.test(sValue)) 모드 ; //특수 문자 <BR> ) {<BR> 사례 1:<BR> 사례 4 :<BR> return sValue.length < 12 ? 3 : 4<BR> break;<BR> }<BR> }<BR> </script><br></head><br><br><body><br> <input type="password " value= "" maxlength="16" /><br> <div id="tips "><br> <span></span><br> <span></span><br> <span></span><br> ><br> </div>