how to determine which Mouse Button was pressed

Answer Posted / prashant ramkishan muttepawar

syntax :: alert("You pressed button: " + event.button)

Return Value ::A Number, representing which mouse button that was pressed when the mouse event occured.

Possible values:
0 : Left mouse button
1 : Wheel button or middle button (if present)
2 : Right mouse button
Note: Internet Explorer 8 and earlier has different return values:

1 : Left mouse button
2 : Right mouse button
4 : Wheel button or middle button (if present)
Note: For a left-hand configured mouse, the return values are reversed

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

code to create a new window

1756


determine which Element received an Event

1909


create Drop-Down Navigation Menus

1709


how to convert between arrays and strings

2118


how to pass data between pages using Frames

2155






how to transform XML Data into HTML

1906


communication between main window and new windows

1715


code to keep a page Out of the browser history

1663


Code to Block submission of form by pressing Enter Key

2089


snippet to prevent submission of form when certain/any validations got failed

1555


code to positioning of window in certain dimensions

1676


function to combine two or more arrays

1709


code to detect versions of different browsers like internet explorer, netscape, mozilla, opera etc

1743


code to get the coordinates of a Click Event

1748


write a code to generate pseudorandom numbes

1793