代码示例:(标识:eg_js_events_onmousedown_2)
<!DOCTYPE html>
<html>
<head>
<script>
function WhichButton(event) {
  alert("You pressed button: " + event.button)
}
</script>
</head>
<body>

<div onmousedown="WhichButton(event);">单击此文本(使用其中一个鼠标按钮)
<p>
0 指定鼠标左键<br>
1 指定鼠标中键<br>
2 指定鼠标右键
</p>

<p>
<b>注释:</b>Internet Explorer 8及更早版本返回另一个结果:<br>
1 指定鼠标左键<br>
4 指定鼠标中键<br>
2 指定鼠标右键
</p>
</div>
</body>
</html>
运行结果: