代码示例:(标识:eg_js_events_type)
<!DOCTYPE html>
<html>
<head>
<script>
function getEventType(event) { 
  document.getElementById("demo").innerHTML = event.type;
}
</script>
</head>

<body>

<img src ="/static/demo/images/eg_planets.jpg" alt="Planets" 
onmousedown="getEventType(event)" />

<p>点击上面的图片,会提示您触发了哪种类型的事件。</p>

<p id="demo"></p>

</body>
</html>
运行结果: