yzx99

导航

 
<html>
<body>
<input id=txt1 type=textbox />
<input type=button value="ASC II-->Unicode" onclick="c();">
<input type=button value="Unicode-->ASC II" onclick="d();">
<input id=txt2 type=textbox />
<script>
function c()
{
 var s=document.all.txt1.value;
 var i;
 var d="";
 var t="";
 for (i=0; i<s.length; i++)
 {
  t="0000" + s.charCodeAt(i).toString(16);
  d = d + "\\u" + t.substr(t.length-4);
 }
 document.all.txt2.value=d;
}
function d()
{
 var s="";
 eval("s='" + document.all.txt1.value + "';");
 document.all.txt2.value=s;
}
</script>
</body>
</html>
posted on 2008-09-04 23:15  yzx99  阅读(547)  评论(0编辑  收藏  举报