加密是为了保护源代码;解密是为了看到源代码
参考文档: http://www.codefans.net/jscss/code/4794.shtml
参考文档: http://www.codefans.net/jscss/code/4794.shtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>汉字和Unicode编码互转</title>
<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>
<textarea id=codes style="width:500px;height:300px"></textarea><br><br>
<input type=button value=Unicode加密 onclick=javascript:codes.value=classObj.ToUnicode(codes.value)>
<input type=button value=Unicode解密 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>