JS 禁止浏览器右键菜单和刷新

 1 <script language="javascript">

 2 //禁止按键F5

 3 document.onkeydown = function(e){

 4     e = window.event || e;

 5     var keycode = e.keyCode || e.which;

 6     if( keycode = 116){

 7         if(window.event){// ie

 8             try{e.keyCode = 0;}catch(e){}

 9             e.returnValue = false;

10         }else{// ff

11             e.preventDefault();

12         }

13     }

14 }

15 

16 //禁止鼠标右键菜单

17 document.oncontextmenu = function(e){

18          return false;

19 }

20 </script>
View Code

 

你可能感兴趣的:(右键菜单)