Home>
<head>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<title>unicode, ascii mutual conversion</title>
<script type="text/javascript">
//asciitounicode ("China");
unicodetoascii ("测试");
//ascii convert unicode
function asciitounicode (content) {
  result="";
  for (var i=0;i<content.length;i ++)
  result +="& #" + content.charcodeat (i) + ";";
  alert ("ascii:" + content + "\ nunicode:" + result);
}
//unicode conversion ascii
function unicodetoascii (content) {
  var code=content.match (/&#(\ d +);/g);
  result="";
  for (var i=0;i<code.length;i ++)
  result +=string.fromcharcode (code [i] .replace (/[&#;]/g, ""));
  alert ("unicode:" + content + "\ nascii:" + result);
}
</script>
</head>
<body>
</body>
</html>
  • Previous Some PHP page scripting tips related to SEO optimization for WordPress
  • Next C # implement App icon with message count