Today I did two small experiments, shielding the keyboard is not available, shielding the mouse and right button is not available
Lab 1: shielding the keyboard is not available
Three Keyboard Events
A. keydown: triggered when you press a key on the keyboard. If you hold down a key, it will continue to be triggered.
B. keypress: triggered when a key is pressed and a character is generated, that is, the Shift, Alt, Ctrl, and other function keys are ignored.
C. keyup: triggered when a button is released
Copy codeThe Code is as follows:
<Script language = "javascript">
Function block (){
Event. keyCode = 0;
Event. returnvalue = false;
Alert ("zookeeper unavailable .");
}
Document. onkeypress = block;
</Script>
Experiment 2: shielding the right cursor is not available
Copy codeThe Code is as follows:
<Script language = "javascript">
Function block (oEvent ){
If (window. event ){
OEvent = window. event;
}
If (oEvent. button = 2 ){
Alert ("the right mouse is unavailable ");
}
}
Document. onmousedown = block;
</Script>
Haha ~ As shown above, the blocking function is implemented.