鼠标事件,一般用button来区分鼠标的按键(dom3标准规定: click事件只能监听左键, 只能通过mousedown和mouseup来判断鼠标键):
1.鼠标左键 button = 0
2.鼠标右键 button = 2
3.鼠标滑轮 button = 1
基于Intranet/Internet 的Web下的办公自动化系统,采用了当今最先进的PHP技术,是综合大量用户的需求,经过充分的用户论证的基础上开发出来的,独特的即时信息、短信、电子邮件系统、完善的工作流、数据库安全备份等功能使得信息在企业内部传递效率极大提高,信息传递过程中耗费降到最低。办公人员得以从繁杂的日常办公事务处理中解放出来,参与更多的富于思考性和创造性的工作。系统力求突出体系结构简明
p.onmousedown = function (e) {
var event = e || window.event;
if(event.button == 2){
console.log('right');
}else if(event.button == 0){
console.log('left');
}
}解决mousedown和click的之间的冲突 (利用事件发生时间来判断 点击事件时间短)
var key = false;//设置了一个标志 false为点击事件 ture为鼠标移动事件 var firstTime = 0; var lastTime = 0; p.onclick = function() { if(key){ console.log('click'); key = false; } } p.onmousedown = function() { firstTime = new Date().getTime(); console.log('mouseDown'); } p.onmouseup = function() { console.log('mouseUp');
//鼠标抬起后 记录时间 超过200ms就是移动事件 lastTime = new Date().getTime(); if( (lastTime - firstTime) < 200){ key = true; } }









