Edit The Code:
See Result »
Try it Yourself - ©
w3big.com
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>本教程(w3big.com)</title> <script> function isKeyPressed(event){ if (event.altKey==1){ alert(" ALT 键被按下!"); }else{ alert(" ALT 键没被按下!"); } } </script> </head> <body onmousedown="isKeyPressed(event)"> <p>点击该段落,尝试按下或者不按下shift 键的效果。</p> </body> </html>