技术笔记
屏蔽网页F12及右键
 moons   2020-08-31 16:46:00   200
专栏分类: javascript
    document.onkeydown = function () {
        if (window.event && window.event.keyCode == 123) {
            //alert("F12被禁用");
            event.keyCode = 0;
            event.returnValue = false;
        }
    };
    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;
        }
    }
Copyright © mos360.cn By Moons Soft Studio 百度统计