运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body onmousedown="isKeyPressed(event)" style="border:1px solid black;padding:8px"> <h1>Mouse Events</h1> <h2>The shiftKey Property</h2> <p>Click in this document.</p> <p>Click in this document when you hold down the shift key.</p> <p id="demo"></p> <script> function isKeyPressed(event) { let text = ""; if (event.shiftKey) { text = "The shift key was pressed!"; } else { text = "The shift key was NOT pressed!"; } document.getElementById("demo").innerHTML = text; } </script> </body> </html>