本文实例为大家分享了js显示隐藏密码输入框值的具体代码,供大家参考,具体内容如下

直接贴上代码

<!DOCTYPE html>
<html>
<head>
 <title>password intput demo</title>
</head>
<style type="text/css">
body{
 margin:0px; 
 background-color: white; 
 font-family: 'PT Sans', Helvetica, Arial, sans-serif; 
 text-align: center; 
 color: #A6A6A6; 
}
/*输入框样式,去掉背景阴影模仿原生应用的输入框*/
input{
width: 100%; 
height: 50px; 
border:none; 
padding-left:3px; 
font-size: 18px; 
}
input:focus { 
 outline: none; 
}
/*显示\隐藏密码图片*/
img{
width: 40px;
height: 25px;
position: absolute; 
right: 0px; 
margin: 15px; 
}
/*登录按钮*/
button{ 
 width: 200px; 
 height: 50px; 
 margin-top: 25px; 
 background: #1E90FF; 
 border-radius: 10px; 
 border:none;
 font-size: 18px;
 font-weight: 700; 
 color: #fff;
}
button:hover {
background: #79A84B; 
outline: 0;
}
/*输入框底部半透明横线*/
.input_block {
 border-bottom: 1px solid rgba(0,0,0,.1);
}
/*container*/
#page_container{
 margin: 50px;
}
</style>

<body>

<div id="page_container">
 <!--密码输入框-->
 <div class="input_block">
 <img id="demo_img" onclick="hideShowPsw()" src="/UploadFiles/2021-04-02/visible.png">

附上图片:

原生js实现密码输入框值的显示隐藏

原生js实现密码输入框值的显示隐藏

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com