仿京东显示隐藏密码明文案例
<body> 密码:<input type="password" /> <button>眼睛</button> </body> <script> let ipt = document.querySelector("input"); let btn = document.querySelector("button"); let arr = 0; btn.onclick = function () { // ipt.type = "text"; if (arr == 0) { ipt.type = "text"; arr = 1; } else { ipt.type = "password"; arr = 0; } }; </script>

浙公网安备 33010602011771号