Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>Mouse Events</h1>
<h2>The button Property</h2>
<div onmousedown="WhichButton(event)" style="border:1px solid black;padding:8px">
<p>Click in this boxt with one of your mouse buttons!"</p>
<p>
0 = The left mouse button<br>
1 = The middle mouse button<br>
2 = The right mouse button
</p>
</div>
<p id="demo"></p>
<script>
function WhichButton(event) {
  let text = "You pressed button: " + event.button;
  document.getElementById("demo").innerHTML = text;
}
</script>
</body>
</html>