Home > Javascript > Disable cut and copy and paste in textbox

Disable cut and copy and paste in textbox


Hi

try this example using  Javascript to disable cut , copy and paste of all textbox in my form:

<script type="javascript" >
  window.onload = function() {
  var txt = null;
  if ((txt = document.getElementsByTagName('TextBox')) != null) {
    for (var i=0; i < txt.length; i++) {
       txt.oncopy = function() { return false; }
       txt.onpase = function() { return false; }
       txt.oncut = function() { return false; }
    }
  }
</script>

Good Luck

Advertisements
Categories: Javascript
  1. L
    March 5, 2009 at 6:40 pm

    You mean onpaste with a ‘t’ right?

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: