<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>测试页</title>
<script language="JavaScript">
function forbid()
{
if(window.event.ctrlKey && window.event.keyCode=="N".charCodeAt(0))
window.event.returnValue = false;  //禁止Ctrl+N
}
</script>
</head><body onkeydown="forbid()" oncontextmenu="window.event.returnValue=false">
<!--  oncontextmenu="window.event.returnValue=false" 禁止右键 -->
</body>
</html>

解决方案 »

  1.   

    <script language="JavaScript">
    function forbid()
    {
    if(window.event.ctrlKey && window.event.keyCode=="N".charCodeAt(0))
    window.event.returnValue = false;  //禁止Ctrl+N
    if(window.event.keyCode==116)
    {
    window.event.keyCode=0;
    window.event.returnValue = false;  //禁止F5
    }
    }
    </script>
      

  2.   

    补充一下:<script language="JavaScript">
    function forbid()
    {
    if(window.event.ctrlKey && window.event.keyCode=="N".charCodeAt(0))
    window.event.returnValue = false;  //禁止Ctrl+N
    if(window.event.keyCode==116 || window.event.keyCode==117)
    {
    window.event.keyCode=0;
    window.event.returnValue = false;  //禁止F5,F6。禁止F6,可以有效的禁止用户先F6,再F5进行刷新
    }
    }
    </script>