zoukankan      html  css  js  c++  java
  • js检测密码强度

    <script>
    function AuthPasswd(string) {
        if(string.length >=6) {
            if(/[a-zA-Z]+/.test(string) && /[0-9]+/.test(string) && /W+D+/.test(string)) {
                noticeAssign(1);
            }else if(/[a-zA-Z]+/.test(string) || /[0-9]+/.test(string) || /W+D+/.test(string)) {
                if(/[a-zA-Z]+/.test(string) && /[0-9]+/.test(string)) {
                    noticeAssign(-1);
                }else if(/[a-zA-Z]+/.test(string) && /W+D+/.test(string)) {
                    noticeAssign(-1);
                }else if(/[0-9]+/.test(string) && /W+D+/.test(string)) {
                    noticeAssign(-1);
                }else{
                    noticeAssign(0);
                }
            }
        }else{
            noticeAssign(null);
        }
    }
     
    function noticeAssign(num) {
        if(num == 1) {
            $('#weak').css({backgroundColor:'#009900'});
            $('#middle').css({backgroundColor:'#009900'});
            $('#strength').css({backgroundColor:'#009900'});
            $('#strength').html('很强');
            $('#middle').html('');
            $('#weak').html('');
        }else if(num == -1){
            $('#weak').css({backgroundColor:'#ffcc33'});
            $('#middle').css({backgroundColor:'#ffcc33'});
            $('#strength').css({backgroundColor:''});
            $('#weak').html('');
            $('#middle').html('中');
            $('#strength').html('');
        }else if(num ==0) {
            $('#weak').css({backgroundColor:'#dd0000'});
            $('#middle').css({backgroundColor:''});
            $('#strength').css({backgroundColor:''});
            $('#weak').html('弱');
            $('#middle').html('');
            $('#strength').html('');
        }else{
            $('#weak').html('&nbsp;');
            $('#middle').html('&nbsp;');
            $('#strength').html('&nbsp;');
            $('#weak').css({backgroundColor:''});
            $('#middle').css({backgroundColor:''});
            $('#strength').css({backgroundColor:''});
        }
    }
    </script>
  • 相关阅读:
    觉察——似非而是的隽语
    蔡志忠:带你看宇宙 颠覆你想象!
    宏图:肯恩·威尔伯眼中的法界|《野兽爱智慧》
    《平常禅》的启示:在平凡生活中活出真实的自己|心灵自由写作群·文选
    我们如何从高纬度世界吸取能量?
    刘希彦·到底该如何进补
    胡因梦|修道上的物化倾向
    【宗萨仁波切】精进,并不表示你要多念经、多念咒!
    Mysql:Authentication Plugins:插件式(权限)认证
    Mysql:通过SSH隧道方式实现安全通讯
  • 原文地址:https://www.cnblogs.com/telwanggs/p/5306116.html
Copyright © 2011-2022 走看看