实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<script src="https://libs.baidu.com/jquery/1.10.2/jquery.min.js">
5
</script>
6
<script>
7
$(document).ready(function(){
8
  $("input").keydown(function(event){ 
9
    $("div").html("Key: " + event.which);
10
  });
11
});
12
</script>
13
</head>
14
<body>
15
16
Enter your name: <input type="text">
17
<p>When you type in the field above, the div element below will display the key number.</p>
18
<div />
19
20
</body>
21
</html>