Change the properties - For disable
Oncopy="return false"
Onpaste="return false"
Oncut="return false"
-------------
Change the properties - For enable
Oncopy="return true"
Onpaste="return true"
Oncut="return true"
--------------------
For enable copy, cut, paste in javascript
document.getElementById('form1').onpaste = 'return true';
document.getElementById('form1').oncopy = 'return true';
document.getElementById('form1').oncut = 'return true';
------------------------
For enable copy paste by javascript function
function test(){
var elems = document.getElementById('form1');
var attrs = ['onpaste','oncopy','oncut'];
for (i = 0; i < elems.length; i++) {
for (j = 0; j < attrs.length; j++) {
if (elems[i].getAttribute(attrs[j])) {
elems[i].setAttribute(attrs[j],elems[i]
.getAttribute(attrs[j])
.replace("return false","return true"));
}
}
}
}
No comments:
Post a Comment