禁止查看网页源码

window.onload = function() {
    //屏蔽键盘事件
    document.onkeydown = function() {
        var e = window.event || arguments[0];
        //F12
        if (e.keyCode == 123) {
            alert('抄袭可耻!!!');
            return false;
            //Ctrl+Shift+I
        } else if ((e.ctrlKey) && (e.shiftKey) && (e.keyCode == 73)) {
            alert('抄袭可耻!!!');
            return false;
            //Shift+F10
        } else if ((e.shiftKey) && (e.keyCode == 121)) {
            alert('抄袭可耻!!!');
            return false;
            //Ctrl+U
        } else if ((e.ctrlKey) && (e.keyCode == 85)) {
            alert('抄袭可耻!!!');
            return false;
        }
    };
    //屏蔽鼠标右键
    document.oncontextmenu = function() {
        alert('抄袭可耻!!!');
        return false;
    }
}

 

posted @ 2020-08-17 22:44  onewaa  阅读(176)  评论(0编辑  收藏  举报