源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

文本加密解密

  • 时间:2020-03-15 05:40 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:文本加密解密
第一步:把如下代码加入到<head>区域中 <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function Encrypt(theText) { output = new String; Temp = new Array(); Temp2 = new Array(); TextSize = theText.length; for (i = 0; i < TextSize; i++) { rnd = Math.round(Math.random() * 122) + 68; Temp[i] = theText.charCodeAt(i) + rnd; Temp2[i] = rnd; } for (i = 0; i < TextSize; i++) { output += String.fromCharCode(Temp[i], Temp2[i]); } return output; } function unEncrypt(theText) { output = new String; Temp = new Array(); Temp2 = new Array(); TextSize = theText.length; for (i = 0; i < TextSize; i++) { Temp[i] = theText.charCodeAt(i); Temp2[i] = theText.charCodeAt(i + 1); } for (i = 0; i < TextSize; i = i+2) { output += String.fromCharCode(Temp[i] - Temp2[i]); } return output; } //  End --> </script> 第二步:把如下代码加入到<body>区域中 <center> <form name=encform onsubmit="return false;">     <textarea name=box1 rows=5 cols=50>Typhoon Start JavaScript Fairyland
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部