春天到了,各种绚丽的花朵都开放了,金黄的油菜花,成了蝴蝶的天地,美丽的蝴蝶在金黄色的舞台上跳着柔和而优美的舞姿。它们一会儿在空中飞舞,一会儿静静地停留在油菜花上。给春天增添了不少乐趣。油菜花的美丽,同时也吸引了不少 "劳动人民 "——蜜蜂,它们总是不分昼夜地不辞辛劳地给油菜花授粉。偶尔一阵微风吹来,金黄的油菜花立刻涌起了高低起伏的 "金浪花 "。远远望去,真是美不胜收!
JavaScript实现input密码框显示/隐藏的功能,供大家参考,具体内容如下
实现代码:
<!DOCTYPE html> <html> <head> <title></title> <style type="text/css"> .password{ position: relative; width: 280px; height: 60px; } .password,.n-txtCss{ display: flex; align-items: center; } .password .fa{ position: absolute; right: 10px; top:15px; font-size: 20px; cursor: pointer; } .fa-eye-slash{ margin-top: 6px; margin-left: 7px; width: 24px; height: 20px; background-image: url(./vivo_img/login/eye-password.png); background-repeat: no-repeat; background-size: 24px 17px; } .fa-eye{ margin-top: 6px; width: 24px; margin-left: 7px; height: 20px; background-image: url(./vivo_img/login/eye-password-active.png); background-repeat: no-repeat; background-size: 24px 17px; } </style> <script type="text/javascript" src="js/jquery-1.12.4.min.js"></script> </head> <body> <dd class="password"> <input type="password" name="" placeholder="设置密码:8-16位字母和数字" maxlength="16" style="outline: none;width: 240px;"> <i class="fa fa-eye-slash"></i> </dd> <script type="text/javascript"> $(".password").on("click", ".fa-eye-slash", function () { $(this).removeClass("fa-eye-slash").addClass("fa-eye"); $(this).prev().attr("type", "text"); }); $(".password").on("click", ".fa-eye", function () { $(this).removeClass("fa-eye").addClass("fa-eye-slash"); $(this).prev().attr("type", "password"); }); </script> </body> </html>
以上就是js实现input密码框显示/隐藏功能。考研,苦大仇深者必胜。更多关于js实现input密码框显示/隐藏功能请关注haodaima.com其它相关文章!