Block the corresponding keyboard button operation
- 2020-03-30 02:17:37
- OfStack
<script language="Javascript">
<!--
//Block the right mouse button, Ctrl+N, Shift+F10, F11, F5 refresh, backspace key
//Author: meizz(plum blossom rain) 2002-6-18
function document.oncontextmenu(){event.returnValue=false;}//Block the right mouse button
function window.onhelp(){return false} //Block F1 help
function document.onkeydown()
{
if ((window.event.altKey)&&
((window.event.keyCode==37)|| //Shield Alt+ direction key please
(window.event.keyCode==39))) //Block Alt+ direction key -
{
alert(" You are not allowed to use ALT+ Direction key forward or back page! ");
event.returnValue=false;
}
if ((event.keyCode==8) || //Mask the backspace delete key
(event.keyCode==116)|| //Mask the 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;} //Shielding F11
if (event.ctrlKey && event.keyCode==78) event.returnValue=false; //Shielding Ctrl + n
if (event.shiftKey && event.keyCode==121)event.returnValue=false; //Shift + F10
if (window.event.srcElement.tagName == "A" && window.event.shiftKey)
window.event.returnValue = false; //Block shift and left mouse button to open a new page
if ((window.event.altKey)&&(window.event.keyCode==115)) //Alt + F4
{
window.showModelessDialog("about:blank","","dialogWidth:1px;dialogheight:1px");
return false;
}
}
-->
</script>