html5中文学习网

您的位置: 首页 > 网络编程 > PHP编程 » 正文

键盘和鼠标事件测试_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>
SKZHTML5中文学习网 - HTML5先行者学习网
SKZHTML5中文学习网 - HTML5先行者学习网
(责任编辑:)
推荐书籍
推荐资讯
关于HTML5先行者 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助