Home Web Front-end JS Tutorial Native js realizes the acquisition of shift/ctrl/alt keys_javascript skills

Native js realizes the acquisition of shift/ctrl/alt keys_javascript skills

May 16, 2016 pm 05:37 PM
alt ctrl shift button

Copy code The code is as follows:

document.onclick = function(e){
alert(getKey (e));
};
function getKey(e){
var e = e || window.event;
var keys = [];

if(e .shiftKey){
keys.push("shift key");
};
if(e.ctrlKey){
keys.push("ctrl key");
};
if(e.altKey){
keys.push("alt key");
};
return keys;
};
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1665
14
PHP Tutorial
1269
29
C# Tutorial
1249
24
What should I do if I can't switch between Chinese and English by pressing shift? What should I do if I can't switch between Chinese and English by pressing shift? Feb 22, 2023 pm 04:13 PM

Solution to the problem that pressing shift cannot switch between Chinese and English: 1. Find the win key and click to open; 2. Find "Settings" and click to open, then open "Time and Language"; 3. Click "Region and Language" and open "Options" "; 4. Click "Options" and then select "shift" in the first line.

What does the ctrl+a key mean? What does the ctrl+a key mean? Mar 16, 2023 pm 03:12 PM

The ctrl+a key means "select all" and is the most common shortcut key in computers. Common keyboard shortcuts include Ctrl+B (organize favorites), Ctrl+C (copy), Ctrl+D ( Delete), Ctrl+E (Search Assistant), Ctrl+V (Paste), etc.

Which key is on l? Which key is on l? Jun 21, 2023 am 11:31 AM

Above l is the shift on the left side of the keyboard. The l here means left, which is opposite to r.

How to turn off the back key vibration function of Redmi K40 Pro? Return key setting guide How to turn off the back key vibration function of Redmi K40 Pro? Return key setting guide Jan 09, 2024 am 09:58 AM

Many friends don’t like the function of key vibration on mobile phones, mainly because it is not practical and relatively speaking, it also consumes more power. Today I will bring you how to turn off the key vibration of Redmi K40Pro, as well as a tutorial on how to set up the return button on Redmi phones. For how to turn off key vibration on Redmi K40Pro, you can follow the steps below: 1. Open the settings menu of your phone. 2. In the settings menu, find the "Sounds & Vibration" option. 3. In the "Sounds and Vibration" options, find the "Key Vibration" setting. 4. Click on the "Key Vibration" setting and then turn off this function. For the settings of the return key on Redmi phones, you can follow the steps below: 1. Open the settings menu of the phone. 2. in

How to add/remove security options from CTRL+ALT+DEL screen How to add/remove security options from CTRL+ALT+DEL screen Apr 26, 2023 pm 12:07 PM

Having the ability to customize allows one to explore more. Windows offers its users the greatest amount of customization, and we are all very grateful. So, have you ever considered customizing your CTRL+ALT+DEL screen? Of course you have, otherwise you wouldn’t be reading this article right now. Well, we have good news for you! You do have the ability to customize the security options screen. You can keep only the options you want and delete all the ones you don't need. CTRL+ALT+DEL screen customization can be done through the Local Group Policy Editor or the Registry Editor. You can choose the method of your choice, both have the same effect. So, what are you waiting for, let’s dive into the article! Hope you like it! Method 1: Edit through local group policy

What is the shift key on mac What is the shift key on mac Mar 13, 2023 pm 02:20 PM

The shift key of Mac is a key above the fn key and below the caps lock key. This key is on the far left side of the keyboard, the second key from the bottom right; the shift key is the upshift key in the keyboard, and can be accessed through " Ctrl+Shift" key combination to switch input methods.

What is the shortcut key for alt+=? What is the shortcut key for alt+=? Mar 10, 2023 am 11:40 AM

alt+= is a shortcut key for quick summing. The method of using the "alt+=" shortcut key is: 1. Open the Excel table file; 2. Create numerical data; 3. Use the mouse to select the data to be summed; 4. Press "alt+=" ” key to sum the selected data.

What does ctrl+spacebar do? What does ctrl+spacebar do? Mar 09, 2023 pm 04:18 PM

The function of "ctrl+spacebar" is to switch between Chinese and English input methods; through "ctrl+spacebar" you can switch back and forth between Chinese and English input methods; "ctrl" is a commonly used key on the keyboard, and its full name is "control". In computer basics they are called "control keys".

See all articles