<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>
 
<body>
 <div style="width:100px; height:100px; background:#09C;"
</body>
<script type="text/javascript">
//F5
document.documentElement.onkeydown=function(e){
    e=e||window.event;
    if(e.keyCode==116){
        if(e.returnValue){
            e.returnValue=false;
        }else{
            e.stopPropagation();
        }
        return false;
    }
}
//右键
document.documentElement.oncontextmenu=function(e){
    e=e||window.event;
    e.cancelBubble = true;
    e.returnValue=false;
    return false;
}
</script>
</html>

 没有测试

 

已经测试了的

/**--  禁止F5刷新 针对IE --**/
document.onkeydown = function()
{
/*
(ctrlKey == true && keyCode == 82)   Ctrl+R   ---刷新
(keyCode == 116)                     F5       ---刷新
(ctrlKey == true && keyCode == 116)  Ctrl+F5  ---强制刷新
*/
   //alert(event.keyCode);
    var k = event.keyCode;
    if((event.ctrlKey == true && k == 82) || (k == 116) || (event.ctrlKey == true && k == 116))
    {
        //return (window.confirm("关闭?"));
        event.keyCode = 0;
        event.returnValue = false;
        event.cancelBubble = true;
    }
}

 

禁止鼠标右键

<body onselectstart="return false">

 

相关文章:

  • 2022-12-23
  • 2021-11-03
  • 2022-12-23
  • 2021-10-06
  • 2022-12-23
  • 2021-09-10
  • 2021-12-16
  • 2022-02-02
猜你喜欢
  • 2021-12-05
  • 2021-12-12
  • 2022-12-23
  • 2021-12-31
  • 2021-09-23
  • 2022-12-23
  • 2021-06-05
相关资源
相似解决方案