javascript键盘事件

javascript键盘事件:

<script type="text/javascript">
<!--
function keyUp(e) {
var currKey=0,e=e||event;
currKey=e.keyCode||e.which||e.charCode;
var keyName = String.fromCharCode(currKey);
    alert("按键码: " + currKey + " 字符: " + keyName);
}
document.onkeyup = keyUp;
-->
</script> 
 

 

你可能感兴趣的:(JavaScript)