中文(繁体)
<!-- 將下列程式碼加到<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>