Latest web development tutorials

button event properties

Event Object Reference Event objects

Definition and Usage

button event property returns an integer that indicates the time when the event is triggered which mouse button is clicked.

grammar

event.button=0|1|2

parameter description
0 Specifies the left mouse button.
1 Specifies the middle mouse button.
2 Specifies the right mouse button.

Note: Internet Explorer 8 and earlier versions of IE have different parameters:

parameter description
1 Specifies the left mouse button. (IE8 and earlier versions of IE)
4 Specifies the middle mouse button. (IE8 and earlier versions of IE)
2 Specifies the right mouse button.


Tips and Notes

Note: For a left-handed mouse configuration, the above parameters are reversed.


Examples

More examples

Pop which mouse button is clicked
Pop which mouse button is clicked.


Event Object Reference Event objects