如题,在线等

解决方案 »

  1.   


    <INPUT TYPE="password" NAME="aa" onkeydown="if(event.keyCode==32) return false;">
      

  2.   


    function check() {
    if(document.getElementById("txtPassword").search(pattern)!=-1) {
    alert("aaaa");
    return false;
    }
    return true;
    }
      

  3.   


    <INPUT TYPE="password" NAME="aa" onkeydown="return event.keyCode!=32">
      

  4.   

    if(/\s/.test(密码变量)){
    alert('密码不能含有空格');
    return false
    }
      

  5.   

    <html xmlns="http://www.w3.org/1999/xhtml" > 
    <script language="javascript" type="text/javascript"> 
       function validSpace(value)
       {
          var pattern=/\s/;
          if(pattern.test(value))
          {
            alert('Input error');
          }
       }
    </script> 
    <body>  
    <input type="password" onblur="validSpace(this.value)"/>
    </html>
      

  6.   

    忘了:pattern=/\s/g;
    function check() {if(document.getElementById("txtPassword").search(/\s/g)!=-1) {
            alert("aaaa");
    return false;
        }
    return true;
    }