格 千格 KiloCell

Keyboard Key Monitor

Get KeyboardEvent Properties with KeyCode in real time

0
Press any key

Press any key on the keyboard to get details of the key in real time

event.key
-
event.code
-
event.which
-
event.location
-
SHIFT CTRL ALT META / WIN
Recent Key Record (Recent Keys)
Key KeyCode Code Modifiers
No record available

In-depth understanding of JavaScript Keyboard Event (KeyboardEvent)

In Web development, processing user keyboard input is at the core of the interactive design. The browser triggers one every time a user presses the button `KeyboardEvent` object. Understanding the properties of this object is essential to develop shortcut support, game control or custom input components.

KeyCode, which is the difference between KeyCode and Code?

  • event.key: Returns the character value generated by the key. For example, press 'a' to return 'a' and press 'Shift' to return "Shift"。 It's the most intuitive attribute of humans.
  • event.code: Returns the identifier for the physical key. For example, whatever your input method, the "A" key on the left side of the keyboard always returns "KeyA"。 This is very useful for the development of the game.
  • event.keyCode / which: This is the attribute of the old version of the standard, and returns the number code of the key. Although abandoned in modern standards, the old code library and certain specific scenarios are still widely used.

Importance of Modifeier Keys

Modifier keys include Shift, Control, Alt and Meta (Win on Windows and Command on Mac) key. By testing the `event. ShiftKey ' equivalent, developers can achieve complex combination key logic, such as `Ctrl + S ' Saves documents or 'Shift + Click ' Multiselection Items.

Keyboard Position (event.location) Properties

Do you know there are two "Enter" or two "Shift" keys on the keyboard? `event.location` The attribute tells you which one the user presses:

  • 0: Standard position (e.g. letters and numbers in the main keyboard area).
  • 1: Left position (e. g. Left Shift or Left Alt).
  • 2: Right position (e. g. right Shift or right Alt).
  • 3: Number of small keyboard areas.

Why does the developer need an online key-testing tool?

Between the Windows vs macOS and the Shrome vs Safari, some special buttons There may be differences between the `keycode ' or `key ' values. Using this tool:

  • Instant debugging: No control log is required to view all properties directly on the page.
  • Validate compatibility: Tests the performance of media keys (sonic, play), functionality keys (F1-F12) in the current environment.
  • Optimizing interaction: Ensure that your web page applications support keyboards in various languages by looking at `event.code ' .

Security and privacy statements

The KiloCell of-gauge keyboard detector is fully local. Your every key-button operation is only on the current page of JavaScript Capture and show that** never** is uploaded to any server or recorded to an external database. You can test any combination of keys.