js字符串转ascii码的代码
js字母的ascii码,js字符串转ascii码的代码教程如下:
输入随机字符串
实现结果:转换成ascii码
js实现代码如下:
function email2ascii(){
var s = document.getElementById('html_content').value;
var as = "";
for(var a = 0; a<s.length; a++){
as += "&#"+s.charCodeAt(a)+";";
}
document.getElementById('ascii_text').innerHTML = '' + as;
return false;
}
显示效果:ASCII在线转换器
参考文章:http://www.theicstock.com/gonglve/1073.html