获取键盘的ascii码
可将如下代码复制出来,在text文本中保存为html即可,在输入框中,可以获取到按键的ascii码。
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<input id="whichkey" value="type something">
<div id="log"></div>
<script>$('#whichkey').bind('keydown',function(e){
$('#log').html(e.type + ': ' + e.which );
}); </script>
</body>
</html>