禁止使用右键

禁止使用右键

   <script>
        document.oncontextmenu = new Function("event.returnValue=false;"); //禁止右键功能
        document.onkeydown = MM_KeyPress;
        function MM_KeyPress(num) {
            //防止系统退格键
            var keycODe = event.keyCODe;
            if (keycode == 8)//屏蔽退格健
            {
                event.keyCode = 0;
                return;
            }
            if (keycode >= 122 && keycode <= 123)//屏蔽f12功能键
            {
                event.keyCode = 0;
                event.returnValue = false;
                return;
            }
        }
        function gg() {
            layer.alert('欢迎使用本网站
'
, { icon: 1, title: '注意', skin: 'layer-ext-moon' }) } function click(e) { if (document.all) { if (event.button == 2 || event.button == 3) { // alert("欢迎光临寒舍,有什么需要帮忙的话,请与站长联系!谢谢您的合作!!!"); oncontextmenu = 'return false'; } } if (document.layers) { if (e.which == 3) { oncontextmenu = 'return false'; } } } if (document.layers) { document.captureEvents(Event.MOUSEDOWN); } document.onmousedown = click; document.oncontextmenu = new Function("return false;") document.onkeydown = document.onkeyup = document.onkeypress = function () { if (window.event.keyCode == 123) { window.event.returnValue = false; return (false); } } </script>

你可能感兴趣的:(前端基础html,css,js,前端,javascript)