HTML 控制密码框的可见和隐藏

html 中如何控制密码框的隐藏和可见呢?



 




 

js方法:

Js代码   收藏代码
  1. /*** 
  2.  * toggle 密码明文 
  3.  * @constructor 
  4.  */  
  5. function ShowHidePW() {  
  6.   
  7.     if (!pwState) {  
  8.         pwFixer.changePasswordVisiblity(1, "new_password2");  
  9.         pwState = true;  
  10.     } else {  
  11.         pwFixer.changePasswordVisiblity(0, "new_password2");  
  12.         pwState = false;  
  13.     }  
  14. }  

 注意:changePasswordVisiblity的第二个参数是元素的id

changePasswordVisiblity方法如下:
Js代码   收藏代码
  1. changePasswordVisiblity= function (what, id) {  
  2.             what = parseInt(what,10);  
  3.             var theEl = document.getElementById(id);  
  4.   
  5.             if (what === 1) { //show  
  6.                 $(theEl).vendorCss("TextSecurity","none");  
  7.             } else {  
  8.                 $(theEl).vendorCss("TextSecurity","disc");  
  9.             }  
  10.             if(!$.os.webkit) {  
  11.                 if(what === 1)  
  12.                     theEl.type="text";  
  13.                 else  
  14.                     theEl.type="password";  
  15.             }  
  16.             theEl = null;  
  17.         }  

 
 demo地址:http://hbjltv.com/ios_www/www/index.html#user_modify_password_panel

注意:demo必须在手机浏览器中访问

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值