Jump to content
  • 0

Как в JavaScript отличить правую кнопку мыши от левой?


OneginZheka
 Share

Question

4 answers to this question

Recommended Posts

  • 0

<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>

в IE работает, в опере нет

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy