鼠標事件
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div>
<button onmousedown="whichButton(event)">點擊</button>
</div>
</body>
<script type="text/javascript">
function whichButton(event)
{
var btnNum = event.button;
if (btnNum==2)
{
alert("您點擊了鼠標右鍵!")
}
else if(btnNum==0)
{
alert("您點擊了鼠標左鍵!")
}
else if(btnNum==1)
{
alert("您點擊了鼠標中鍵!");
}
else
{
alert("您點擊了" + btnNum+ "號鍵,我不能確定它的名稱。");
}
}
</script>
</html>