欢迎来到9酷文库!

如何设置网站屏蔽右键菜单,屏蔽复制,屏蔽选中

掠影 分享 时间: 阅读:65 我要投稿 复制全文 下载全文

精选文章 -->

精选颜色代码表 精选宝塔面板屏蔽垃圾搜索引擎蜘蛛和扫描工具的办法 精选帝国CMS7.5怎么支持php7.4版本的方法(已测试) 精选301重定向详解 精选wordpress文章中微信打赏功能的2种实现方法

网站屏蔽鼠标右键,可以屏蔽复制,屏蔽选中,屏蔽剪切。下面是青青模板网整理的关于如何屏蔽鼠标右键的解决方案和思路,方便新手站长们在利用帝国cms建网站的时候,可以少走一些弯路。

将下列代码复制粘贴到模板-公共模板变量-底部即可

<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>

以上就是关于帝国cms使用教程中"如何设置网站屏蔽右键菜单,屏蔽复制,屏蔽选中"的全部内容

108059
领取福利

微信扫码领取福利

微信扫码分享