//js 屏蔽
window.document.oncontextmenu = function () { event.returnValue = false; }//屏蔽鼠标右键 
window.document.onselectstart = function () { event.returnValue = false; }//屏蔽鼠标选择
window.window.onhelp = function (){return false } //屏蔽F1帮助 
window.document.onmousewheel = function ()//屏蔽Shift+滚轮,Ctrl+滚轮
{
    if (event.shiftKey || event.ctrlKey) {
        event.keyCode = 0;
        event.returnValue = false;
    }
}
window.document.onkeydown = function()
{
    if ((window.event.altKey) &&
        ((window.event.keyCode == 37) ||   //屏蔽 Alt+ 方向键 ← 
            (window.event.keyCode == 39)))   //屏蔽 Alt+ 方向键 → 
    {
        event.returnValue = false;
    }
    if ((event.keyCode == 116) ||                 //屏蔽 F5 刷新键 
        (event.ctrlKey && event.keyCode == 82)) { //Ctrl + R 
        event.keyCode = 0;
        event.returnValue = false;
    }
    if (event.keyCode == 32 || event.keyCode == 8)    //屏弊空格键,后退键
    {
        if (!(event.srcElement.tagName == "INPUT" && event.srcElement.type == "text") && event.srcElement.tagName != "TEXTAREA") {
            event.keyCode = 0;
            event.returnValue = false;
        }
    }
    //屏蔽F12
    if (window.event && window.event.keyCode == 123) {
        event.keyCode = 0;
        event.returnValue = false;
        return false;
    }


    if (event.keyCode == 27) { event.keyCode = 0; event.returnValue = false; }  //屏蔽ESC

    if (event.keyCode == 114) { event.keyCode = 0; event.returnValue = false; }  //屏蔽F3
    if (event.keyCode == 122) { event.keyCode = 0; event.returnValue = false; }  //屏蔽F11
    if (event.ctrlKey && event.keyCode == 67) { event.keyCode = 0; event.returnValue = false; }    //屏蔽 Ctrl+c
    if (event.ctrlKey && event.keyCode == 86) { event.keyCode = 0; event.returnValue = false; }    //屏蔽 Ctrl+v
    if (event.ctrlKey && event.keyCode == 70) { event.keyCode = 0; event.returnValue = false; }    //屏蔽 Ctrl+f
    if (event.ctrlKey && event.keyCode == 87) { event.keyCode = 0; event.returnValue = false; }    //屏蔽 Ctrl+w
    if (event.ctrlKey && event.keyCode == 69) { event.keyCode = 0; event.returnValue = false; }    //屏蔽 Ctrl+e
    if (event.ctrlKey && event.keyCode == 72) { event.keyCode = 0; event.returnValue = false; }    //屏蔽 Ctrl+h
    if (event.ctrlKey && event.keyCode == 73) { event.keyCode = 0; event.returnValue = false; }    //屏蔽 Ctrl+i
    if (event.ctrlKey && event.keyCode == 79) { event.keyCode = 0; event.returnValue = false; }    //屏蔽 Ctrl+o
    if (event.ctrlKey && event.keyCode == 76) { event.keyCode = 0; event.returnValue = false; }    //屏蔽 Ctrl+l
    if (event.ctrlKey && event.keyCode == 80) { event.keyCode = 0; event.returnValue = false; }    //屏蔽 Ctrl+p
    if (event.ctrlKey && event.keyCode == 66) { event.keyCode = 0; event.returnValue = false; }    //屏蔽 Ctrl+b
    if (event.ctrlKey && event.keyCode == 78) { event.keyCode = 0; event.returnValue = false; }  //屏蔽 Ctrl+n
}

 

posted on 2017-09-06 11:06  高兴happy  阅读(1265)  评论(0编辑  收藏  举报