JavaScript鼠标按键动作

来源:互联网 发布:apache fastcgi c 编辑:程序博客网 时间:2024/05/18 03:06
<html xmlns="http://www.w3.org/1999/xhtml" ><head>   <title>测试鼠标按键信息</title><script language="javascript">function click() {   //搜狗浏览器、Firefox下/*   switch(event.button)   {    case 0:  alert('左键');break;case 1:  alert('中键');break;case 2:  alert('本网站禁用右键');break;default:  alert ("其它");break;   }*/   //IE浏览器、Firefox下  switch( window.event.button )   {    case 1:  alert('左键');break;case 2:  alert('本网站禁用右键');break;case 4:  alert('中键');break;default:  alert ("其它");break;   }   }document.onmousedown=click;  //绑定事件</script></head><body  ><div>这是一个不能使用右键的案例</div></body></html>

另外一些鼠标按键事件

http://www.jb51.net/article/21590.htm

0 0