防止鼠标右键复制文字代码 简单易用

防鼠标右键复制代码,需要拿走,

    document.onkeydown = function(){
    if(window.event && window.event.keyCode == 123) {
        alert("浏览器搜索【南图博客】即可访问本站");
        event.keyCode=0;
        event.returnValue=false;
    }
    if(window.event && window.event.keyCode == 13) {
        window.event.keyCode = 505;
    }
    if(window.event && window.event.keyCode == 8) {
        alert(str+"\n请使用Delete键进行字符的删除操作!");
        window.event.returnValue=false;
    }
}
document.oncontextmenu = function (event){
    if(window.event){
    event = window.event;
    alert("请记住本站永久域名【www.nta6.com】");
    }
    try{
    var the = event.srcElement;
        if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){
        return false;
        }
        return true;
    }
    catch (e){
        return false;
    }
}

效果别人点击右键会跳出


南图
南图管理员

  • 声明:本文由南图于2020-03-29发表在南图博客 - 优质稀缺资源发布平台,努力创造一个顶级资源站,如有疑问,请联系我们。
  • 本文地址:https://www.nta6.com/post/109.html
上一篇:有这八个习惯,想赚钱太难 站长我全中
下一篇:小米手机怎么关掉广告?关闭广告的方法。

留言评论

暂无留言
取消
扫码支持