源代碼
點擊運行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>教程</title> <script type="text/javascript"> function getEventType(event){ alert(event.type); } </script> </head> <body onmousedown="getEventType(event)"> <p>在文檔中點擊某個位置。消息框會提示你觸發的事件類型。</p> </body> </html>
運行結果