屏蔽BcakSpace 、F5 、CTRL+R 刷新键

var checkSpecialKey = function(e){
    e=e||window.event;
    var k = e.which||e.keyCode;
    //屏蔽   BcakSpace   后退键
    //屏蔽   F5   刷新键
    //屏蔽 CTRL+R 刷新键
    if(k == 8 || k == 116 || (e.ctrlKey && k == 82 ) ){
        if(e.preventDefault){
            e.preventDefault();
        }else{
            e.keyCode = 0;
            e.returnValue=false;
        }
    }
}
if(document.addEventListener){
    document.addEventListener("keydown",checkSpecialKey,false);
}else{
    document.attachEvent("onkeydown",checkSpecialKey);
}
 

你可能感兴趣的:(ca)