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: