JavaScript字符串加密
文章来源:365jz.com 点击数:
420 更新时间:2009-09-16 11:42
参与评论
Code
1 function strEncode(aString) {
2 var t = "", a = "", s = 136;
3 for(var x=0; x<aString.length; x++) {
4 a = aString.charCodeAt(x) + s;
5 if(x!=0) {
6 t += '_';
7 }
8 t += new Number(a).toString(10);
9 }
10 return t;
11 }
12
13 function strDecode(aString) {
14 var s = 136;
15 var a = aString.split('_');
16 for(var x=0; x<a.length; x++) {
17 a[x] = String.fromCharCode(a[x] - s);
18 }
19 return a.join('');
20 }
如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛
------分隔线----------------------------