The example of this article is about JS prevent page refresh and backward method. Share to everyone for your reference. The implementation methods are as follows:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26-27--28 29---30 31--32 33 34 35 36 37 38-39 40 41 42 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66-67-68 69 70 71 72 73 74 75 76 77 78 79-80 |
<script language= "JavaScript" >//Disable F5 key function Document.onkeydown () {if (event.keycode==116) {Event.keycode = 0; Event.cancelbubble = true; return false; }//No Right-key pop-up menu function Document.oncontextmenu () {return false;}//The following code implements full screen function window.onload () {var Request = NE W Array ();//save parameter var s = location.search.substring (1); if (s && s!= "") {var list = S.split ("&"); for (Var i=0 i < list.length; i++) {var pair = List[i].split ("=" ); if (Pair[0] && pair[0]!= "") {Request[unescape (pair[0]) = Unescape (Pair[1]);} var fullscreen=request["fullscreen"]; if (fullscreen!= "yes") {var file =self.location; var a = window.open ("About:blank", "", "Fullscreen=yes"); Self.opener=null; Self.close (); A.location=file + "Fullscreen=yes"; } </script> <script language= "Javascript" ><!--//Shielded right mouse button, CTRL + N, SHIFT+F10, F11, F5 refresh, backspace//author: Meizz (Plum blossom rain) 2002-6-18 function Document.oncontextmenu () {event.returnvalue=false;}//Mask mouse right button function Window.onhelp () {REturn false}//shield F1 help function Document.onkeydown () {if (Window.event.altKey) && ((window.event.keycode==37) | | Shielding ALT + Direction key ← (window.event.keycode==39))//shielding ALT + Direction key →{alert ("You are not allowed to use ALT + Direction key forward or back page!") "); Event.returnvalue=false; }/* Note: This is not really shielding ALT + direction key, because ALT + arrow pop-up warning box, hold down the ALT key, with the mouse point off the warning box, this shielding method is ineffective. In the future, if there is a real master to screen the Alt key method, please inform. */if ((event.keycode==8) | |//SHIELDING BACKSPACE Delete key (event.keycode==116) | |/Mask F5 Refresh key (Event.ctrlkey && event.keycode==82)) {/ /ctrl + R event.keycode=0; Event.returnvalue=false; } if (event.keycode==122) {event.keycode=0;event.returnvalue=false;}//Mask F11 if (Event.ctrlkey && event.keycode==78) Event.returnvalue=false; Shielding CTRL + N if (event.shiftkey && event.keycode==121) Event.returnvalue=false; Shielded Shift+f10 if (window.event.srcElement.tagName = = "A" && window.event.shiftKey) Window.event.returnValue = False Screen shift plus left mouse button new page if ((Window.event.altKey) && (window.event.keycode==115))//Shield Alt+f4 { Window.showmodelessdiaLog ("About:blank", "", "dialogwidth:1px;dialogheight:1px"); return false; }} </script> |
The
wants this article to help you with your JavaScript programming.