javascript| Conversion
Use JavaScript to convert
<style>
Body {
font-size:9pt; padding-right:0px; padding-left:0px; padding-bottom:0px; padding-top:0px;
}
Input {
font-size:9pt; height:13pt;
}
</style>
<script language= "JavaScript1.2" >
/*
This following code are designed and writen by Windy_sk <seasonx@163.net>
can use it freely, but u must held all the copyright items!
*/
function Str2unicode (str) {
var arr = new Array ();
for (Var i=0;i<str.length;i++) {
Arr[i]= "&#" + str.charcodeat (i) + ";";
}
Return (Arr.tostring (). Replace (/,/g, ""));
}
function Unicode2ostr (str) {
var re=/&#[\da-fa-f]{1,5};/ig;
var arr=str.match (re);
if (arr==null) return ("");
for (Var i=0;i<arr.length;i++) {
Arr[i]=string.fromcharcode (Arr[i].replace (/[&#;] /g, ""));
}
Return (Arr.tostring (). Replace (/,/g, "")
}
function Modi_str () {
if (document.all.text.method.checked) {
if (document.all.text.decode.value!= "") {
Document.all.text.encode.value = Str2unicode (Document.all.text.decode.value);
}else{
Document.all.text.decode.value = Unicode2ostr (Document.all.text.encode.value);
}
}else{
if (document.all.text.encode.value!= "") {
Document.all.text.decode.value = Unicode2ostr (Document.all.text.encode.value);
}else{
Document.all.text.encode.value = Str2unicode (Document.all.text.decode.value);
}
}
}
</script>
<title>Unicode</title>
<form name=text>
Text prototype:<br>
<textarea name= "decode" cols= "rows=" ></textarea>
<br>
Convert Code:<br>
<textarea name= "encode" cols= "rows=" ></textarea>
<br>
<input type= "checkbox" Name= "method" checked> forward conversion
<input Type=button value= "OK" >
<input type=reset value= "emptying" >
<input Type=button value= "Select All" >
</form>