Event JavaScript Tutorial

The which property refers to which key or mouse button was pressed or clicked.
The value returned for mouse events is a numeric value 1, 2, or 3, representing the left, middle, and right mouse buttons, respectively.
The value returned for keyboard events is a character representation for the key that was pressed.


    
    Using the which property of the event object
    
    
    

    This example uses the which property of the event object to determine
    which mouse button is pressed.