function test()
{
alert(event. x " " event.y);
alert(event.button);
}
/*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);
}
event.x Mouse horizontal axis
event.y Mouse vertical axis
event.keycode Keyboard value
events.button= =0 default. No buttons were pressed.
events.button==1 Left mouse button
events.button==2 Right mouse button
events.button==3 Press the left and right mouse buttons simultaneously
events.button==4 Middle mouse button
events.button==5 The left and middle mouse buttons are pressed simultaneously
events.button==6 The right and middle mouse buttons are pressed simultaneously
events.button==7 All three keys are pressed Down
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn