執行 ❯
建立您
自己的
網站
×
更改方向
儲存程式碼
更改主題,深色/淺色
前往 Spaces
<!DOCTYPE html> <html> <head> <script> function isKeyPressed(event) { var text = "The shift key was NOT pressed!"; if (event.shiftKey == 1) { text = "The shift key was pressed!"; } document.getElementById("demo").innerHTML = text; } </script> </head> <body onmousedown="isKeyPressed(event)"> <p>Click on this paragraph. An alert box will tell you if you pressed the shift key or not.</p> <p id="demo"></p> </body> </html>