javascript 获取键盘、鼠标ascii码

<html>
<head>
<title></title>
<script language="javascript" type="text/javascript">
    function gokey() {//获取键盘上的键的ASCII码
        alert(window.event.keyCode);
    }
    function gomouse() {//获取鼠标上的键的ASCII码
        alert(window.event.button);
    }
    document.onkeydown = gokey;
    document.onmousedown = gomouse;
</script>
</head>
<body>
</body>
</html>


你可能感兴趣的:(JavaScript,ASCII)