编码解码 Unicode to ascii

来源:互联网 发布:nginx http 307 编辑:程序博客网 时间:2024/06/07 06:03
<html><head><title>Ascii<--> Unicode 编码转换—蚊子弹琴</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script Language=Javascript>var classObj=     {       ToUnicode:function(str)        {        return escape(str).replace(/%/g,"\\").toLowerCase();       },       UnUnicode:function(str)       {        return unescape(str.replace(/\\/g, "%"));       },      copyingTxt:function(str)      {       document.getElementById(str).select();        document.execCommand("Copy");       }    }</script></head><body align="center"><h3>Ascii Unicode 编码转换</h3><textarea id=codes style="width:500px;height:300px"></textarea><br><br><input type=button value="编码"  onclick=javascript:codes.value=classObj.ToUnicode(codes.value)><input type=button value="解码"  onclick=javascript:codes.value=classObj.UnUnicode(codes.value)><input type=button value=复制文本 onclick=javascript:classObj.copyingTxt("codes")><input type=button value=清空内容 onclick=javascript:codes.value=""></body></html>

0 0