Home > Article > Web Front-end > What is the role of shiftKey mouse event in JavaScript?
#shiftkey mouse event property is used to display whether the SHIFT key was pressed when the mouse button was clicked.
You can try running the following code to learn how to implement the shiftKey mouse event in JavaScript.
<!DOCTYPE html> <html> <body onmousedown = "funcShiftKey(event)"> <div>Press and hold SHIFT key and then click here.</div> <script> function funcShiftKey(event) { if (event.shiftKey) { alert("SHIFT key: Pressed"); } else { alert("SHIFT key: NOT Pressed"); } } </script> </body> </html>
The above is the detailed content of What is the role of shiftKey mouse event in JavaScript?. For more information, please follow other related articles on the PHP Chinese website!