- </pre><pre name="code" class="javascript">
-
-
- function ToDBC(txtstring)
- {
- var tmp = "";
- for(var i=0;i<txtstring.length;i++)
- {
- if(txtstring.charCodeAt(i)==32)
- {
- tmp= tmp+ String.fromCharCode(12288);
- }
- if(txtstring.charCodeAt(i)<127)
- {
- tmp=tmp+String.fromCharCode(txtstring.charCodeAt(i)+65248);
- }
- }
- return tmp;
- }
-
- function ToCDB(str)
- {
- var tmp = "";
- for(var i=0;i<str.length;i++)
- {
- if(str.charCodeAt(i)>65248&&str.charCodeAt(i)<65375){
- tmp += String.fromCharCode(str.charCodeAt(i)-65248);
- }else {
- tmp += String.fromCharCode(str.charCodeAt(i));
- }
- }
- return tmp
- }