There are many ways to disable the keyboard function keys. This article describes in detail how to disable the keyboard function keys and other keys using javascript. For more information, see
The Code is as follows:
After you insert the highlighted red content to a webpage, you can right-click the page to make it invalid.
Onselectstart = "return false" prohibit selection, ondragstart = "return false" prohibit drag and drop, oncopy = document. selection. empty () prohibit copying.
Save prohibited: And put it in the head.
Disable pasting:
Disable input method:
Right-click the block button:
Function document. oncontextmenu () {event. returnValue = false ;}
Help for blocking F1:
Function window. onhelp () {return false}
Shield other keys
The Code is as follows:
Function document. onkeydown ()
{
If (window. event. altKey )&&
(Window. event. keyCode = 37) | // mask Alt + direction key seek
(Window. event. keyCode = 39) // mask Alt + direction key →
{
Alert ("You are not allowed to use ALT + arrow keys to move forward or backward the webpage! ");
Event. returnValue = false;
}
/* Note: this does not really block Alt + direction keys,
Because when the Alt + direction key pop-up warning box is displayed, press and hold the Alt key,
With the mouse clicked off the warning box, this blocking method will become invalid. If
Which of the following methods does the master really block the Alt key. */
If (event. keyCode = 8) | // shield the unregeed deletion key
(Event. keyCode = 116) | // block 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;} // block F11
If (event. ctrlKey & event. keyCode = 78) event. returnValue = false; // block Ctrl + n
If (event. shiftKey & event. keyCode = 121) event. returnValue = false; // block shift + F10
If (window. event. srcElement. tagName = "A" & window. event. shiftKey)
Window. event. returnValue = false; // block shift with the left mouse button to open a new page
If (window. event. altKey) & (window. event. keyCode = 115) // block Alt + F4
{
Window. showModelessDialog ("about: blank", "", "dialogWidth: 1px; dialogheight: 1px ");
Return false;
}
}
Print blocking:
The Code is as follows: