The example in this article describes the way JS prevents page refreshes and retreats. Share to everyone for your reference. The implementation method is as follows:
<script language= "JavaScript" >//Disable F5 key function Document.onkeydown () {if (event.keycode==116) {Eve
Nt.keycode = 0;
Event.cancelbubble = true;
return false;
}//No right-click pop-up menu function Document.oncontextmenu () {return false;
The following code implements full screen function window.onload () {var Request = new 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 (MeiFlower rain) 2002-6-18 function Document.oncontextmenu () {event.returnvalue=false}//Mask mouse right button function Window.onhelp () {return False}//shielded 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) | |/Shielding F5 Refresh key (Event.ctrlkey && event.keycode==8
2) {//ctrl + R event.keycode=0;
Event.returnvalue=false; } if (event.keycode==122) {event.keycode=0;event.returnvalue=false;}//Masking F11 if (Event.ctrlkey && event.keycod
e==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))//Screen ALT+F4 {Window.showmodel
Essdialog ("About:blank", "" "," dialogwidth:1px;dialogheight:1px ");
return false;
}} </script>
The
wants this article to help you with your JavaScript programming.