click.js
function
mousestatus(e)
... {
if (!e)e = window.event;
btn = e.button;
whichone = btn < 2 ? "左键" : "右键";
message = e.type + ":" + whichone + " ";
document.form1.info.value += message;
}
obj = document.getElementById( " testlink " );
obj.onmousedown = mousestatus;
obj.onmouseup = mousestatus;
obj.onclick = mousestatus;
obj.ondblclick = mousestatus;
... {
if (!e)e = window.event;
btn = e.button;
whichone = btn < 2 ? "左键" : "右键";
message = e.type + ":" + whichone + " ";
document.form1.info.value += message;
}
obj = document.getElementById( " testlink " );
obj.onmousedown = mousestatus;
obj.onmouseup = mousestatus;
obj.onclick = mousestatus;
obj.ondblclick = mousestatus;
020.htm
<
html
>
< head >
< title > study 020 </ title >
</ head >
< body >
< h1 > 鼠标点击测试 </ h1 >
< h2 >< a href ="#" id ="testlink" > 测试链接 </ a ></ h2 >
< form name ="form1" >
< textarea rows ="10" cols ="70" name ="info" ></ textarea >
</ form >
< script language ="JavaScript" type ="text/javascript" src ="click.js" ></ script >
</ body >
</ html >
< head >
< title > study 020 </ title >
</ head >
< body >
< h1 > 鼠标点击测试 </ h1 >
< h2 >< a href ="#" id ="testlink" > 测试链接 </ a ></ h2 >
< form name ="form1" >
< textarea rows ="10" cols ="70" name ="info" ></ textarea >
</ form >
< script language ="JavaScript" type ="text/javascript" src ="click.js" ></ script >
</ body >
</ html >