要做一个用户注册页面,为了安全,我想让用户在填写密码的时候不能将其他地方的密码复制粘贴到我的密码控件(TextBox)里,应该怎么才能做到呢?

解决方案 »

  1.   

    可以在文本框中写:onpaste="return false"javascript:
    <html>
    <head>
    <script type="text/javascript">
    function KeyDown(){    
      if ((window.event.ctrlKey)&& 
          ((window.event.keyCode==99)||  
           (window.event.keyCode==118))){ 
         alert("禁止复制粘贴!"); 
         event.returnValue=false; 
         } 
      }
    </script>
    </head>
    <body onmousedown="KeyDown()">
     
     <p>Click somewhere in the document.
    An alert box will tell you if you 
    pressed the CTRL key or not.</p>
    </body>
    </html> 
    网上搜到的  我也没试过
      

  2.   

    <asp:TextBox id="Pwd" Type="Password" runat=server" onpaste="return false" />