运行 ❯
获取您
自己
的网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 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>