密碼(password)的顯示隱藏


<!DOCTYPE html>
<html>

    <head>
        <meta charset="UTF-8">
        <title>密碼顯示隱藏</title>
    </head>
    <style>
        .pass {
            position: relative;
        }
        
        .pass img {
            position: absolute;
            top: 3px;
            left: 186px;
        }
    </style>

    <body>
        <div class="form-group pass">
            <label class="control-label" for="ds_host">密碼</label>
            <input class="password form-control" type="password" value="" placeholder="輸入您的用戶名">
            <img class="passimgs" src="images/xs.png">
        </div>
    </body>

</html>
<script src="https://cdn.bootcss.com/jquery/1.12.3/jquery.min.js"></script>
<script>
    var pimg=$(".passimgs");
    pimg.mouseover(function() {
        $(this).attr("src", "images/xianshi.png");    
        $(".password").attr("type", "text");          
    });          
    pimg.mouseout(function() {   
        $(this).attr("src", "images/xs.png");        
        $(".password").attr("type", "password");  
    });
</script>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM