Jquery判斷密碼的強弱

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <style type="text/css">
    #divpwd{ height:50px;}
    img{ margin-top:10px;}
    </style>
    <script src="emailvalidatorjs.js" type="text/javascript"></script>
    <script src="jquery-1.9.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $('#txtPassword').keyup(function () {
                var score = testpass($(this).val());
                if (score < 34) {
                    $('img').attr('src', 'images/pas2.jpg');
                }
                else if (score >= 34 && score < 68) {
                    $('img').attr('src', 'images/pas3.jpg');
                }
                else {
                    $('img').attr('src', 'images/pas4.jpg');
                }
            })
        })
    </script>
</head>
<body>
<div>
<div>UserName:<input id="txtUserName" type="text" /></div>
<div id="divpwd">Password:<input id="txtPassword" type="text" /><img alt="" src="images/pas1.jpg" /></div>
</div>
</body>
</html>
發佈了133 篇原創文章 · 獲贊 3 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章