```
//若是你不想别人扒掉你的模板,可以把这段js代码加到你网页上,即可屏蔽鼠标右键菜单、复制粘贴、选中等


//屏蔽右键菜单
document.oncontextmenu = function(event) {

if (window.event) {

event = window.event;

}


try {

var the = event.srcElement;

if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {

return false;

}

return true;


} catch (e) {

return false;

}

}

 


//屏蔽粘贴
document.onpaste = function(event) {
if (window.event) {

event = window.event;

}

try {

var the = event.srcElement;

if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {

return false;

}

return true;

} catch (e) {

return false;

}

}

 

//屏蔽复制

document.oncopy = function(event) {

if (window.event) {

event = window.event;

}

try {

var the = event.srcElement;

if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {

return false;

}

return true;

} catch (e) {

return false;

}

}


//屏蔽剪切

document.oncut = function(event) {

if (window.event) {

event = window.event;

}

try {

var the = event.srcElement;

if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {

return false;

}

return true;

} catch (e) {

return false;

}

}


//屏蔽选中

document.onselectstart = function(event) {

if (window.event) {

event = window.event;

}

try {

var the = event.srcElement;

if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {

return false;

}

return true;

} catch (e) {

return false;

}

}
```

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-09
  • 2021-08-26
  • 2022-12-23
  • 2022-01-18
  • 2021-06-17
  • 2021-12-06
猜你喜欢
  • 2022-12-23
  • 2021-09-17
  • 2021-05-26
  • 2022-12-23
  • 2022-02-11
相关资源
相似解决方案