中文(简体)
<!-- 把下列代码加到<body>区域中 --> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function showKeyCode() { var character = document.characterCode.character.value.substring(0,1); var code = document.characterCode.character.value.charCodeAt(0); var msg = "这个字母"+character+"的ASCII码是:"+code+"."; alert(msg); } // End --> </script> <form name="characterCode"> <center>请输入一个字母: <input type="text" name="character" size="15"> <input type="button" value="看一下键值" onClick="showKeyCode();"> </center> </form>