密码框明文暗文切换

来源:互联网 发布:apm源码 github 编辑:程序博客网 时间:2024/06/05 10:29
<input type="password" id="pw" name="pw" style="width: 200px;">

<input type="checkbox" id="showPass" onclick="aaa();">显示密码

function aaa() {
    var passType = document.getElementById('pw').type;
    if(passType == "text"){
        document.getElementById('pw').type = "password";
    }else{
        document.getElementById('pw').type = "text";
    }
}

0 0