转---JS 获取鼠标左右键
原文:http://blog.csdn.net/mine3333/article/details/7291557
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>
event.x 鼠标横轴
event.y 鼠标纵轴
event.keycode 键盘值
events.button==0 默认。没有按任何按钮。
events.button==1 鼠标左键
events.button==2 鼠标右键
events.button==3 鼠标左右键同时按下
events.button==4 鼠标中键
events.button==5 鼠标左键和中键同时按下
events.button==6 鼠标右键和中键同时按下
events.button==7 所有三个键都按下
转---JS 获取鼠标左右键的更多相关文章
- JS获取鼠标左(右)滑事件
鼠标左(右)滑也是网站开发中常见的效果之一,这里对鼠标左(右)滑做出一些解释. 首先要获取需要左右滑事件的节点: eg: var div=document.getElementById("d ...
- JS中鼠标左右键以及中键的事件
在三维场景中有时候需要判断鼠标的事件,除了使用的click事件,只有鼠标左键有效,而右键无效.而对于onmousedown.onmouseup的时候鼠标的事件左键/右键有效.详细请看w3c上的资料. ...
- 原生js获取鼠标坐标方法全面讲解-zmq
原生js获取鼠标坐标方法全面讲解:clientX/Y,pageX/Y,offsetX/Y,layerX/Y,screenX/Y 一.关于js鼠标事件综合各大浏览器能获取到坐标的属性总共以下五种:eve ...
- js获取鼠标位置的各种方法
在一些DOM操作中我们经常会跟元素的位置打交道,鼠标交互式一个经常用到的方面,令人失望的是不同的浏览器下会有不同的结果甚至是有的浏览器下没结果,这篇文章就上鼠标点击位置坐标获取做一些简单的总结,没特殊 ...
- js获取鼠标坐标位置兼容多个浏览器
这个是IE 11 下兼容下视图测试时可用. $(window).bind('beforeunload', function (event) { var _this = this; var x = ev ...
- JS获取鼠标位置,兼容IE FF
由于Firefox和IE等浏览器之间对js解释的方式不一样,firefox下面获取鼠标位置不能够直接使用clientX来获取.网上说的一般都是触发mousemove事件才行.我这里有两段代码,思路都一 ...
- js 获取鼠标的手势方向角度
需要获取鼠标的移动角度 1.mousedown 确定起始点 2.mousemove 确立相关点 3.先计算两点的斜率,然后根据三角函数和反三角函数.转换为角度 <!DOCTYPE html> ...
- js获取鼠标的位置
<!doctype html><html><head><meta charset="utf-8"><title>获取鼠标 ...
- JS 获取鼠标坐标
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
随机推荐
- DES加密/解密
/// <summary> /// DES加密/解密类. /// </summary> public class DESEncrypt { #region ========加密 ...
- [Manacher+bit]Palindrome
https://nanti.jisuanke.com/t/15428 题目大意:离散表示的字符串,求其最长回文串长度. 解题关键:若只用Manacher算法,在统计sum时会超时,所以加一个树状数组来 ...
- how to download a file with Nodejs(without using third-party libraries)用node下载文件
创建HTTP GET请求并将其管理response到可写文件流中: var http = require('http'); var fs = require('fs'); var file = fs. ...
- Flask01 初识flask、创建flask应用、flask启动配置
1 什么是flask Flask是一个使用 Python 编写的轻量级 Web 应用框架.其 WSGI 工具箱采用 Werkzeug ,模板引擎则使用 Jinja2 . 百度百科:点击前往 中文文档: ...
- 报错:defined for 'courierAction_pageQuery' in namespace '/'Error creating bean with name 'cn.itcast.bos.web.action.base.CourierAction': Injection of autowired dependencies failed; nested exception is or
No qualifying bean of type [cn.itcast.bos.web.service.base.CourierService] found for dependency: exp ...
- Learning Python 003 缩进
Python 缩进 Python的代码中不使用{}大括号来来表示一个代码块,而是使用缩进方式.像下面这段代码: # print absolute value of an integer: a = 10 ...
- 16、SGE作业调度系统的简介
转载:http://www.zilhua.com/2222.html http://gridscheduler.sourceforge.net/htmlman/ SGE作业调度系统的简介 一.常见的几 ...
- 21 、GPD-PSL-VCF
https://genome.ucsc.edu/FAQ/FAQformat.html#format9 1.Variant Call Format(VCF) Example ##fileformat=V ...
- 简单的html兼容(参考js和css的常规写法)
参考往常css/js的浏览器选择加载 <!--[if lte IE 8]> <link rel="stylesheet" href="IEBrower. ...
- 项目:IT资源共享资源(登录后端)<2>
公众号技术标签 小程序 PHP 源码 项目 ThinkPHP5.0目录结构,新建一个模块api,该模块下面有controller.model 目录,前者放控制器,写API接口(这里是简单的api写法) ...