Copy codeThe Code is as follows:
Function test ()
{
Alert (event. x + "" + event. y );
Alert (event. button );
}
/* The right-click menu is not displayed */
Document. oncontextmenu = function ()
{
Return false;
}
/* Document. onmousedown = function ()
{
If (event. button = 1)
{Alert ("left ")}
If (event. button = 2)
{Alert ("right ")}
}*/
Document. onkeydown = function ()
{
Alert (event. keyCode );
}
</Script>
Event. x horizontal mouse axis
Event. y vertical axis of the mouse
Event. keycode keyboard Value
Events. button = 0 by default. No buttons are pressed.
Events. button = 1 left mouse button
Events. button = 2 right-click
Events. button = 3 press the mouse key at the same time
Events. button = 4 middle mouse buttons
Events. button = 5 press both the left mouse button and the middle mouse button
Events. button = 6 Right-click and press
Events. button = 7 all three keys are pressed