<script type="text/javascript">
function test(){
// 数字转换位字符
var code = String.fromCharCode(97);
// 字符转换为数字
var s="a";
alert(code);
alert(s.charCodeAt(0));
}
test();
</script>
<script type="text/javascript">
function test(){
// 数字转换位字符
var code = String.fromCharCode(97);
// 字符转换为数字
var s="a";
alert(code);
alert(s.charCodeAt(0));
}
test();
</script>
转载于:https://my.oschina.net/xiaoen/blog/134991