发生何种事件类型?

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script>
  5. function getEventType(event) {
  6. document.getElementById("demo").innerHTML = event.type;
  7. }
  8. </script>
  9. </head>
  10.  
  11. <body>
  12.  
  13. <img src ="/i/eg_planets.jpg" alt="Planets"
  14. onmousedown="getEventType(event)" />
  15.  
  16. <p>点击上面的图片,会提示您触发了哪种类型的事件。</p>
  17.  
  18. <p id="demo"></p>
  19.  
  20. </body>
  21. </html>