zoukankan      html  css  js  c++  java
  • 前段禁止禁止复制粘贴禁止F12

    禁止F12
    <script> document.onkeydown = function () { if (window.event && window.event.keyCode == 123) { alert("F12被禁用"); 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 + " 请使用Del键进行字符的删除操作!"); window.event.returnValue = false; } } </script>
    禁止右击
    <script> 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; } } </script>
    禁止粘贴
    <script>
        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;
            }
        }
    </script>
    禁止复制
    <script>
        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;
            }
        }
    </script>
    禁止剪贴
    <script>
        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;
            }
        }
    </script>
    屏蔽选中
    <script>
        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>
  • 相关阅读:
    【leetcode】Basic Calculator III
    【leetcode】Reorganize String
    【leetcode】Largest Plus Sign
    【leetcode】Reach a Number
    【leetcode】Network Delay Time
    【leetcode】Monotone Increasing Digits
    【leetcode】Submission Details
    【leetcode】Valid Parenthesis String
    【leetcode】Max Area of Island
    New Concept English three(14)
  • 原文地址:https://www.cnblogs.com/yugueilou/p/14870114.html
Copyright © 2011-2022 走看看