<html>
<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>
<script>
function WhichButton(event) {
alert("You pressed button: " + event.button)
}
</script>
</body>
</html>