var input=document.getElementsByTagName("input")[1];
document.onmouseup=function(evt){
if(getbutton(evt)==0){ alert("按了左键")}
if(getbutton(evt)==1){ alert("按了中键")}
if(getbutton(evt)==2){ alert("按了右键")}
}
function getbutton(evt){ var e=evt||window.event; 兼容ie和非id浏览器
if(evt){
return e.button;
}else if(window.event){
switch (e.button){
case 1:
return 0;
case 4:
return 1;
case 2:
return 2;
case 0:
return 2;
}
}
}
时间: 2024-10-13 11:53:14