您的位置:首页 >> 精品文萃 >> 电脑互联 >> 内容

禁止右键菜单代码、禁止复制粘贴代码

作者:不详 时间:2020-8-16 5:09:29 点击:
字号

  核心提示: 代码如下: script type='text/javascript'//屏蔽右键菜单document.oncontextmenu = function (event){if(window.eve...

代码如下:

<script type="text/javascript">
//屏蔽右键菜单
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;
}
}
</script>
原文:http://blog.cccyun.cn/post-224.html

来源:网络

特别声明:以上作品内容(包括在内的视频、图片或音频)为用户上传并发布,本平台仅提供信息存储空间服务。如遇版权问题,请立即联系删除。

Notice: The content above (including the videos, pictures and audios if any) is uploaded and posted by the user. This platform merely provides information storage space services. In case of copyright issues, please contact us at the first time and we will remove the related content immediately.

相关文章
  • 没有相关文章
相关评论
我要评论
  • 大名: (*请输入您的大名,缺省将显示IP地址。)
  • 内容:
  • 愛德華網絡世界(www.ok5266.com) © 2004-2024 版权所有 All Rights Reserved.
  • E-mail:ok5266@gmail.com E-ICP備:05013632
  • Powered by Edward Web World V4.0.6