键盘和鼠标事件测试
时间:2007-02-17 来源:PHP爱好者
<HTML>
<HEAD>
<TITLE>键盘和鼠标事件测试</TITLE>
<script language="javascript">
<!--
function keyDown(e) {
s = "";
for(v in event)
s += v+"="+event[v]+"<br>";
view.innerHTML = s;
return false;
}
document.onkeydown=keyDown
document.onkeyup=keyDown
document.onmousedown=keyDown
document.onmouseup=keyDown
document.onmousemove=keyDown
document.onmouseover=keyDown
document.onmouseout=keyDown
document.onkeypress=keyDown
//-->
</script>
</HEAD>
<BODY>
<p>请操作鼠标或键盘</p> <input type=text>
<table border>
<tr><td>123</td></tr>
</table>
<table border>
<tr>
<td colspan=3 id="keyview"> </td>
</tr>
<tr>
<tr>
<td onClick="key(this)" style="cursor=hand;">7</td>
<td onClick="key(this)" style="cursor=hand;">8</td>
<td onClick="key(this)" style="cursor=hand;">9</td>
</tr>
<tr>
<td onClick="key(this)" style="cursor=hand;">4</td>
<td onClick="key(this)" style="cursor=hand;">5</td>
<td onClick="key(this)" style="cursor=hand;">6</td>
</tr>
<tr>
<td onClick="key(this)" style="cursor=hand;">1</td>
<td onClick="key(this)" style="cursor=hand;">2</td>
<td onClick="key(this)" style="cursor=hand;">3</td>
</tr>
<tr>
<td colspan=2 onClick="key(this)" style="cursor=hand;">0</td>
<td onClick="key(this)"> </td>
</tr>
</table>
<span id="view"></span>
</BODY>
</HTML>
php爱好者站 http://www.phpfans.net 网页制作|网站建设|数据采集.