- -
这照片,貌似高中生...
LZ好年轻...'中文'.charCodeAt(0); //中字的unicode编码

解决方案 »

  1.   

    charCodeAt 方法说明:charCodeAt(index : Number)返回一个整数,该整数表示 String 对象中指定位置处的字符的 Unicode 编码。一个字符串中的第一个字符位于索引位置 0,第二个字符位于索引位置 1,依此类推。如果指定 index 没有字符,将返回 NaN。
    <script language="javascript">document.write("charCodeAt 方法<br>输入一个字符:<input type='text' id='ipt' size='10' value='a'> <input type='button' value='点我一下' onclick='alert(document.getElementById(\"ipt\").value.charCodeAt(0))'>")</script>