html 中如何控制密码框的隐藏和可见呢?
js方法:
/*** * toggle 密码明文 * @constructor */ function ShowHidePW() { if (!pwState) { pwFixer.changePasswordVisiblity(1, "new_password2"); pwState = true; } else { pwFixer.changePasswordVisiblity(0, "new_password2"); pwState = false; } }
注意:changePasswordVisiblity的第二个参数是元素的id
changePasswordVisiblity方法如下:
changePasswordVisiblity= function (what, id) { what = parseInt(what,10); var theEl = document.getElementById(id); if (what === 1) { //show $(theEl).vendorCss("TextSecurity","none"); } else { $(theEl).vendorCss("TextSecurity","disc"); } if(!$.os.webkit) { if(what === 1) theEl.type="text"; else theEl.type="password"; } theEl = null; }
demo地址:http://hbjltv.com/ios_www/www/index.html#user_modify_password_panel
注意:demo必须在手机浏览器中访问