zoukankan      html  css  js  c++  java
  • Jquery 实现密码框的显示与隐藏【转载自http://blog.csdn.net/fengzhishangsky/article/details/11809069】

    <html>
     <head>
      <script type="text/JavaScript"  src="jQuery-1.5.1.min.js"></script>
      <script type="text/javascript">
       $(function(){
        $("#chk").bind({//绑定一个点击事件
         click: function(){
          if($(this).attr("checked")){//如果选中显示密码 那么type=“text”的密码文本框就显示

    //或者写为:if($("#chk").is(':checked'))
            $("#passwd2").val($("#passwd").val());
            $("#passwd").hide();
            $("#passwd2").show();
          }else{
            $("#passwd").val($("#passwd2").val());//如果没有选中显示密码 那么type=“password”的密码文本框就显示 但是后面传参要注意是那个文本框中的值
            $("#passwd2").hide();
            $("#passwd").show();
          }
         }
        });
       });
      </script>
     </head>
     <body>
      <form name="formName">
       <input id="passwd" type="password" size="24" maxlength="17"  style="ime-mode: disabled; display: inline;"/>
       <input id="passwd2" type="text"       size="24" maxlength="17"   style="ime-mode: disabled; display: none;" />
       <input id="chk" type="checkbox" />显示密码
      </form>
     </body>
    </html>

  • 相关阅读:
    Qt环境搭建(Visual Studio)
    HTML基础
    关于Qt
    I am back
    Node Security
    Mobile Assistant
    Home Server
    抉择-什么最重要
    在一个JSP页面中包含另一个JSP页面的三种方式
    JS控制DIV隐藏显示
  • 原文地址:https://www.cnblogs.com/Lxiaojiang/p/6140438.html
Copyright © 2011-2022 走看看