javascript下中文/漢 字和Unicode編碼/解碼(Encode/Decode)互​轉代碼(HTML ConvertZ)

javascript下中文/漢 字和Unicode編碼/解碼(Encode/Decode)互​轉代碼(HTML ConvertZ)

javascript下中文/漢 字和Unicode編碼/解碼(Encode/Decode)轉代碼(HTML ConvertZ)

 

 

線上Unicode字元轉換

—————

html原始碼:

 

<html>
<head>
<metahttp-equiv=”Content-Type”content=”text/html; charset=utf-8″/>
<title>javascript下漢字和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>
<textareaid=”codes”style=”width:100%;height:600px”></textarea><br><br>
<inputtype=”button”value=”Unicode加密”onclick=”javascript:codes.value=classObj.ToUnicode(codes.value)”/>
<inputtype=”button”value=”Unicode解密”onclick=”javascript:codes.value=classObj.UnUnicode(codes.value)”/>
<inputtype=”button”value=”複製文本內容”onclick=”javascript:classObj.copyingTxt(‘codes’)”/>
<inputtype=”button”value=”清空文本內容”onclick=”javascript:codes.value=””/>
</body>
</html>

 

 

 



發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *