Javascript examples for DOM:Mouse Event
The shiftKey property indicates if the "SHIFT" key was pressed.
This property is read-only.
A Boolean, indicating whether the "SHIFT" key was pressed.
The following code shows how to find out whether or not the "SHIFT" key was pressed.
<!DOCTYPE html> <html> <body onmousedown="isKeyPressed(event)"> <script> function isKeyPressed(event) {//w w w .j a v a 2 s .c o m if (event.shiftKey) { console.log("The SHIFT key was pressed!"); } else { console.log("The SHIFT key was NOT pressed!"); } } </script> </body> </html>