Sunday, March 18, 2012

Javasctipt to restrict the delete and backspace button

keypress,copy the text and paste the text in text box in asp.net


 <asp:TextBox ID="txtEDate" runat="server" onkeypress="return false;" oncopy="return false;"
                     oncut="return false;" onpaste="return false;" onkeydown="CheckKey() ;" Width="152px"></asp:TextBox>

Javasctipt to restrict the delete and backspace button press on textbox
onkeydown="CheckKey() ;"


<script type="text / Javascript">
 function CheckKey() 
{
          var keyCode = (event.which) ? event.which : event.keyCode;
          if ((keyCode == 8) || (keyCode == 46))
              event.returnValue = false;
 }
</script>

No comments:

Post a Comment

Comments

Search

Custom Search
Protected by Copyscape Plagiarism Software