Home > Web Front-end > JS Tutorial > body text

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

WBOY
Release: 2016-05-16 17:14:26
Original
1062 people have browsed it

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
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template