<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
<title>键盘事件</title>
<script>
var outtext=""
function fun1(){
outtext+="onkeydown <br/>"
}
function fun2(){
outtext+="onkeypress <br/>"
}
function fun3(){
outtext+="onkeyup <br/>"
document.getElementById("div1").innerHTML=outtext;
}
//弹出ASCII码
function fun4(){
alert(event.keyCode);
}
function fun5(){
if(event.keyCode==13){
event.keyCode=9;
}
}
</script>
</head>
<body>
<input type="text" id="key123" onkeydown="fun1(this)" onkeypress="fun2(this)" onkeyup="fun3(this)"/>
<div id="div1">
</div>
<input type="text" onkeydown="fun5()"/><br/>
<input type="text"/>
</body>
</html>