如:
<input type="password"  placeholder="密码">
随着键盘输入的改变,密码的个数如何获取呢求指教

解决方案 »

  1.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript">
    function init(){
    var input=document.getElementById("test");
    input.onkeyup=function(){
    document.getElementById("show").innerHTML=this.value.length;
    }
    }
    window.onload=init;
    </script>
    </head><body>
    <input type="password"  placeholder="密码" id="test">
    <div id="show"></div>
    </body>
    </html>
    类似这样试试
      

  2.   

    document.getElementById("表单id").value.length;
    这样就可以获取到了
      

  3.   

    <input onkeyup="document.title=this.value.length"我还以为你已经解决了呢
      

  4.   

    我掉错事件了
    $(function(){
    $("#password").keyup(function(){
    alert(this.value.length);
    });
    });