JS中把字符轉成ASCII值

字符轉ascii碼:用charCodeAt(); ascii碼轉字符:用fromCharCode();code

str="A";
code = str.charCodeAt(); 
str2 = String.fromCharCode(code);
str3 = String.fromCharCode(0x60+26);
document.write(code+'<br />');
document.write(str2+'<br />');
document.write(str3);

輸出: 65 A zci