首页 > Web开发 > 详细

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

时间:2015-10-10 02:05:02      阅读:352      评论:0      收藏:0      [点我收藏+]

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


bubuko.com,布布扣
?



bubuko.com,布布扣
?

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必须在手机浏览器中访问

?

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

原文:http://hw1287789687.iteye.com/blog/2247791

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!