标签:head query src back chart append script from div
<!DOCTYPE html> <html> <head> <script src="/jquery/jquery-1.11.1.min.js"></script> <script> var str="cww" for(var i=0;i<3;i++){ document.write("Origin:"+str[i]); $("body").append("<br>") t1=str.charCodeAt(i); document.write("ASCII:"+t1); t2=t1.toString(2); $("body").append("<br>") document.write("Binary:"+t2); $("body").append("<br>") t3=parseInt(t2,2); document.write("BackToAsc:\t"+t3); $("body").append("<br>") t4=String.fromCharCode(t3); document.write("Binary:"+t4); $("body").append("<br>") $("body").append("<br>") } </script> </head> <body> </body> </html>
结果:
Origin:c ASCII:99 Binary:1100011 BackToAsc:99 Binary:c Origin:w ASCII:119 Binary:1110111 BackToAsc:119 Binary:w Origin:w ASCII:119 Binary:1110111 BackToAsc:119 Binary:w
【JS】CharToAsciiToBinaryToAsciiToChar
标签:head query src back chart append script from div
原文地址:http://www.cnblogs.com/liez/p/6654135.html