Home  >  Article  >  Web Front-end  >  JS method to shield the keyboard from being unavailable and the right mouse button from being unavailable_javascript skills

JS method to shield the keyboard from being unavailable and the right mouse button from being unavailable_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:14:261030browse

I did two small experiments today, blocking the keyboard from working and blocking the right mouse button from working

Experiment 1, shielded keyboard is not available

There are 3 keyboard events

a. keydown: Triggered when a key on the keyboard is pressed. If a key is held down, it will continue to trigger

b. keypress: Triggered when a key is pressed and a character is generated, that is, function keys such as Shift, Alt, Ctrl, etc. are ignored

c, keyup: triggered when a key is released

Copy code The code is as follows:


< ;script language="javascript">

function block(oEvent) {
if (window.event) {

Haha~ The blocking function is implemented as above
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn