将文本内容转译成加密文本,在某些情况下还是比较实用的,下面通过 js 简单实现下,感兴趣的朋友不要错过
Javascript 是一种由 Netscape 的 LiveScript 发展而来的原型化继承的基于对象的动态类型的区分大小写的客户端脚本语言,主要目的是为了解决服务器端语言,比如 Perl,遗留的速度问题,为客户提供更流畅的浏览效果。
- <SCRIPT language=JavaScript>
- < !--
- var Words;
- function SetWords(word) {
- Words = word.value;
- }
- function SetNewWords(form) {
- var NewWords;
- NewWords = unescape(Words);
- form.NewWords.value = NewWords;
- }
- function SetNewWords1(form) {
- var NewWords;
- NewWords = escape(Words);
- form.NewWords.value = NewWords;
- }
- // -->
- </SCRIPT>
- <body>
- <table align=center>
- <TR>
- <form method=post>
- <TD align=center>
- <P>
- <textarea cols=65 name=Word onchange=SetWords(this) rows=5>
- </textarea>
- </P>
- <P>
- <input name=uncode onclick=SetNewWords(this.form) type=button value="解密">
- <input name=encode onclick=SetNewWords1(this.form) type=button value="加密">
- </P>
- <P>
- <textarea cols=65 name=NewWords rows=5>
- </textarea>
- </P>
- </form>
- </td>
- </tr>
- </table>
- </body>
来源: