EventaltKey, ctrlKey, shiftKey attribute parsing _ javascript skills

Source: Internet
Author: User
This article mainly analyzes the EventaltKey, ctrlKey, and shiftKey attributes in detail. If you need a friend, you can refer to them and hope to help you. Event. altKey
Function: checks whether the Alt key is held down when an event occurs.

Syntax: event. altKey

Value: true | false

Note:

If the altKey attribute is true, the Alt key is pressed and maintained when the event occurs. If the attribute is false, the Alt key is not pressed.
The altKey attribute can be used with the mouse or keyboard to create shortcuts.

Event. ctrlKey
Function: checks whether the Ctrl key is held down when an event occurs.

Syntax: event. ctrlKey

Value: true | false

Note:

If the ctrlKey attribute is true, the Ctrl key is pressed and maintained when the event occurs. If the value is false, the Ctrl key is not pressed.
The ctrlKey attribute can be used with the mouse or keyboard to create shortcuts.

Event. shiftKey
Function: checks whether the Shift key is held down when an event occurs.

Syntax: event. shiftKey

Value: true | false

Note:

If the shiftKey attribute is true, the Shift key is pressed and maintained when the event occurs. If it is false, the Shift key is not pressed.
The shiftKey attribute can be used with the mouse or keyboard. It is mostly used to create shortcuts.

Instance 1
Combined Operation example.

The Code is as follows:


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.