核心提示:function test(){alert(event.x+ +event.y);alert(event.button);}/*右键菜单不显示*/document.oncontextmenu=func...
function test()
{
alert(event.x+" "+event.y);
alert(event.button);
}
/*右键菜单不显示*/
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>
定义和用法
onmousedown 属性在鼠标按钮在元素上按下时触发。
提示:相对于 onmousedown 事件的事件次序(限于鼠标左/中键):
onmousedown onmouseup onclick
相对于 onmousedown 事件的事件次序(限于鼠标右键):
onmousedown onmouseup oncontextmenu
注释:onmousedown 属性不适用以下元素:<base>、<bdo>、<br>、<head>、<html>、<iframe>、<meta>、<param>、<script>、<style> 或 <title>。