zoukankan      html  css  js  c++  java
  • js禁止页面刷新禁止用F5键刷新,禁止右键

    1. <script     language="javascript">          
    2. //禁止用F5键          
    3. function     document.onkeydown()          
    4. {          
    5.           if     (     event.keyCode==116)          
    6.             {          
    7.                     event.keyCode     =     0;          
    8.                     event.cancelBubble     =   true;          
    9.                   return   false;          
    10.             }          
    11. }          
    12.            
    13. //禁止右键弹出菜单          
    14. function     document.oncontextmenu()          
    15. {          
    16.       return   false;          
    17. }          
    18.            
    19. //下面代码实现全屏显示          
    20. function     window.onload(){          
    21.       var     Request     =   new     Array();//保存参数          
    22.       var     s     =     location.search.substring(1);          
    23.       if     (s     &&     s!=""){          
    24.       var     list     =     s.split("&");          
    25. for     (var     i=0;     i     <     list.length;     i++){          
    26. var     pair     =     list[i].split("=");          
    27. if     (pair[0]     &&     pair[0]     !=""){          
    28. Request[unescape(pair[0])]     =     unescape(pair[1]);          
    29. }          
    30. }          
    31.         }          
    32.            
    33.       var     fullscreen=Request["fullscreen"];          
    34.       if(fullscreen!="yes"){          
    35.       var     file     =self.location;          
    36.       var     a     =     window.open("about:blank","","fullscreen=yes")          
    37.         self.opener=null          
    38.         self.close()          
    39.         a.location=file     +   "?fullscreen=yes";          
    40.         }          
    41. }          
    42. </script>      
    43. <script language="Javascript"><!--       
    44. //屏蔽鼠标右键、Ctrl+N、Shift+F10、F11、F5刷新、退格键       
    45. //Author: meizz(梅花雨) 2002-6-18       
    46. function document.oncontextmenu(){event.returnValue=false;}//屏蔽鼠标右键       
    47. function window.onhelp(){return false} //屏蔽F1帮助       
    48. function document.onkeydown()       
    49. {       
    50. if ((window.event.altKey)&&       
    51. ((window.event.keyCode==37)|| //屏蔽 Alt+ 方向键 ←       
    52. (window.event.keyCode==39))) //屏蔽 Alt+ 方向键 →       
    53. {       
    54. alert("不准你使用ALT+方向键前进或后退网页!");       
    55. event.returnValue=false;       
    56. }       
    57. /* 注:这还不是真正地屏蔽 Alt+ 方向键,
    58. 因为 Alt+ 方向键弹出警告框时,按住 Alt 键不放,
    59. 用鼠标点掉警告框,这种屏蔽方法就失效了。以后若
    60. 有哪位高手有真正屏蔽 Alt 键的方法,请告知。*/       
    61. if ((event.keyCode==8) || //屏蔽退格删除键       
    62. (event.keyCode==116)|| //屏蔽 F5 刷新键       
    63. (event.ctrlKey && event.keyCode==82)){ //Ctrl + R       
    64. event.keyCode=0;       
    65. event.returnValue=false;       
    66. }       
    67. if (event.keyCode==122){event.keyCode=0;event.returnValue=false;} //屏蔽F11       
    68. if (event.ctrlKey && event.keyCode==78) event.returnValue=false; //屏蔽 Ctrl+n       
    69. if (event.shiftKey && event.keyCode==121)event.returnValue=false; //屏蔽 shift+F10       
    70. if (window.event.srcElement.tagName == "A" && window.event.shiftKey)       
    71. window.event.returnValue = false; //屏蔽 shift 加鼠标左键新开一网页       
    72. if ((window.event.altKey)&&(window.event.keyCode==115)) //屏蔽Alt+F4       
    73. {       
    74. window.showModelessDialog("about:blank","","dialogWidth:1px;dialogheight:1px");       
    75. return false;       
    76. }       
    77. }       
    78. </script>
  • 相关阅读:
    mysql 优化
    二叉查找树(BST)、红黑树、B-树、B+树
    HashMap,ConcurrentHashMap 原理分析
    2019_京东JAVA实习生招聘机试第一题
    2019年今日头条机试_JAVA后台岗_第二题
    2019年今日头条机试_JAVA后台岗_第一题
    C++_pthread read-write lock_读写锁_visual studio 2015下配置
    Winsock2_WSADATA
    leetcode_1011. Capacity To Ship Packages Within D Days_binary search二分
    leetcode_684. Redundant Connection
  • 原文地址:https://www.cnblogs.com/xdot/p/5860479.html
Copyright © 2011-2022 走看看