javascript 防止复制+禁止右键

function iEsc() { return false; }

function iRec() { return true; }

function DisableKeys() {

    if (event.ctrlKey || event.shiftKey || event.altKey) {

        window.event.returnValue = false;

        iEsc();

    }

}

document.ondragstart = iEsc;

document.onkeydown = DisableKeys;

document.oncontextmenu = iEsc;

if (typeof document.onselectstart != "undefined")

    document.onselectstart = iEsc;

else {//qsyz.net

    document. = iEsc;

    document. = iRec;

}

function DisableRightClick(www_qsyz_net) {

    if (window.Event) {

        if (www_qsyz_net.which == 2 || www_qsyz_net.which == 3)

            iEsc();

    }

    else

        if (event.button == 2 || event.button == 3) {

            event.cancelBubble = true

            event.returnValue = false;

            iEsc();

        }

}


 不会到会,只是一个过程! 


你可能感兴趣的:(JavaScript,禁止右键,防止复制)