Javascript examples for DOM:Key Event
The metaKey property indicates if the "META" key was pressed.
This property is read-only.
A Boolean, indicating whether the "META" key was pressed
The following code shows how to find out whether or not the "META" key was pressed when a keyboard key is pressed:
<!DOCTYPE html> <html> <body> <input type="text" onkeydown="isKeyPressed(event)"> <p id="demo"></p> <script> function isKeyPressed(event) {// w w w.j av a 2s. co m var x = document.getElementById("demo"); if (event.metaKey) { x.innerHTML = "The META key was pressed!"; } else { x.innerHTML = "The META key was NOT pressed!"; } } </script> </body> </html>