您的位置:首页 > Web前端 > JQuery

jquery处理鼠标左中右键事件

2017-07-26 09:45 477 查看
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>智能社——http://www.zhinengshe.com</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">

</head>
<body>
<input type="button" value="按钮" id="test">
<script type="text/javascript" src="js/jquery.min.js"></script>
<script>
$("#test").mousedown(function(e){
if(e.which==1){
alert("这是 左 键单击事件");
}else if(e.which==2){
alert("这是 中 键单击事件");
}else if(e.which==3){
alert("这是 右 键单击事件");
}
})
</script>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: