Forgot password?
 Register now

Prohibit right-click menu code, prohibit copy and paste code

[Copy link]
Post time 2023-1-5 14:18:29 | Show all posts |Read mode
File or source code
title: Prohibit right-click menu code, prohibit copy and paste code
classification: [Web develop] » [PHP programming]
Resource Type: Source code
<script type="text/javascript">
// shield the right-click menu
document.oncontextmenu = function (event){
if(window.event){
event = window.event;
}try{
var the = event.srcElement;
if (!((the.tagName == "INPUT" &amp;&amp; the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){
return false;
}
return true;
}catch (e){
return false;
}
}
//shield paste
document.onpaste = function (event){
if(window.event){
event = window.event;
}try{
var the = event.srcElement;
if (!((the.tagName == "INPUT" &amp;&amp; the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){
return false;
}
return true;
}catch (e){
return false;
}
}
// shield copy
document.oncopy = function (event){
if(window.event){
event = window.event;
}try{
var the = event.srcElement;
if(!((the.tagName == "INPUT" &amp;&amp; the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){
return false;
}
return true;
}catch (e){
return false;
}
}
// shield cut
document.oncut = function (event){
if(window.event){
event = window.event;
}try{
var the = event.srcElement;
if(!((the.tagName == "INPUT" &amp;&amp; the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){
return false;
}
return true;
}catch (e){
return false;
}
}
// shield selected
document.onselectstart = function (event){
if(window.event){
event = window.event;
}try{
var the = event.srcElement;
if (!((the.tagName == "INPUT" &amp;&amp; the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){
return false;
}
return true;
} catch (e) {
return false;
}
}
</script>





the last one:Blog home page background music HTML code
the next one:Dynamic digital clock js+flash code

Use magic Report

Mobile version|Small black house|I love source code

Copyright 2011 - 2012 Lnqq.NET.All Rights Reserved

About this site - Copyright statement - Ln Studio! - Advertising contact

The resources on this site come from the Internet and are only for user testing. The relevant copyright belongs to the original author.

快速回复 To Top 返回列表