JS简单验证密码强度

    <script type="text/javascript">  
        $("#validate").click(function(){  
            if(isSimplePwd($("#password").val())<3){  
                alert("密码过于简单!");  
            }  
        })  
        /** 
        *简单验证密码强度 
        *必须包含数字、小写字母、大写字母、特殊字符 其三 
        *如果返回值小于3 则说明密码过于简单  
        */  
        function isSimplePwd(s){  
            if(s.length<6){  
                return 0;  
            }  
            var ls = 0;  
            if(s.match(/([a-z])+/)){  
                ls++;  
            }  
            if(s.match(/([0-9])+/)){  
                ls++;  
            }  
            if(s.match(/([A-Z])+/)){  
                ls++;  
            }  
            if(s.match(/[^a-zA-Z0-9]+/)){  
                ls++;  
            }  
            return ls;  
        }  
    </script>  

编程技巧