字符转ascii码:用charCodeAt();
ascii码转字符:用fromCharCode();
看一个小例子
<script><BR>str="A";<BR>code = str.charCodeAt(); <BR>str2 = String.fromCharCode(code);<BR>str3 = String.fromCharCode(0x60+26);
<P>document.write(code+'<br />');<BR>document.write(str2+'<br />');<BR>document.write(str3);<BR></script>
输出:
65
A
z