我想在鼠标的状态下状态或了状态如何检查当前的鼠标按钮状态使用JavaScript
document.onmousemove = mouseMove;
document.onmousedown = mouseDown;
document.onmouseup = mouseUp;
function mouseMove(ev) {
mouseState="";
//How can I know the state button of mouse button from here
if(mouseState=='down') {
console.log('mouse down state')
}
if(mouseState=='up') {
console.log('mouse up state')
}
}
function mouseDown(ev) {
console.log('Down State you can now start dragging');
//do not write any code here in this function
}
function mouseUp(ev) {
console.log('up state you cannot drag now because you are not holding your mouse')
//do not write any code here in this function
}
,当我提出我的鼠标,程序应该显示的要求值mouseState现在在控制台上向下或向下移动
此问题与[chrome问题](http://www.pmarks.net/posted_links/chromium_up_down_bug.html)有关。而IE也显示出同样的问题。有没有解决方案 – vusan
我想知道鼠标按钮的状态,因为[this](http://stackoverflow.com/questions/12191743/how-to-know-the-current-state-of-mouse-buttonmouseup-状态或mousedown状态)问题。 – vusan