button ʼþÊôÐÔ

¶¨ÒåºÍÓ÷¨

button ʼþÊôÐÔ¿É·µ»ØÒ»¸öÕûÊý£¬Ö¸Ê¾µ±Ê¼þ±»´¥·¢Ê±ÄĸöÊó±ê°´¼ü±»µã»÷¡£

Óï·¨

event.button=0|1|2
²ÎÊý ÃèÊö
0 ¹æ¶¨Êó±ê×ó¼ü¡£
1 ¹æ¶¨Êó±êÖмü¡£
2 ¹æ¶¨Êó±êÓÒ¼ü¡£

Internet Explorer ÓµÓв»Í¬µÄ²ÎÊý£º

²ÎÊý ÃèÊö
1 ¹æ¶¨Êó±ê×ó¼ü¡£
4 ¹æ¶¨Êó±êÖмü¡£
2 ¹æ¶¨Êó±êÓÒ¼ü¡£

ÌáʾºÍ×¢ÊÍ

×¢ÊÍ£º¶ÔÓÚ¹ßÓÃ×óÊÖµÄÊó±êÅäÖã¬ÉÏÃæµÄ²ÎÊýÊǵߵ¹µÄ¡£

Ìáʾ£ºMozilla µÄ Ctrl¨CClick ²ÎÊýÊÇ 2 £¨µÈ¼ÛÓÚÓÒ»÷£©¡£

ʵÀý

The following example alerts which mouse button was clicked:

<html>
<head>
<script type="text/javascript">
function whichButton(event)
  {
    if (event.button==2)
      {
      alert("You clicked the right mouse button!")
      }
    else
      {
      alert("You clicked the left mouse button!")
      }
  }
</script>
</head>

<body onmousedown="whichButton(event)">
	
<p>Click in the document. An alert box will 
alert which mouse button you clicked.</p>

</body>
</html>

TIY

button
¼ì²âÄĸöÊó±ê¼ü±»µã»÷ÁË¡£
VUE