electricperi的专栏

精灵之家 技术子站

原创 网页加密WEB页代码收藏

<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网页加密</title>
<script language="javascript">

function encrypt()
{   // 加密

 var SourceCode;

 SourceCode=document.F1.S1.value;
 //alert(SourceCode);

 if(SourceCode=="") { alert("没有可以加密的代码![原始代码]框中没有内容。"); return; }

 document.F1.S2.value=encodeURIComponent(SourceCode);

}

function decode()
{   //译码

 var DecodeStr;

 DecodeStr=document.F1.S2.value;
 //alert(DecodeStr);
 if(DecodeStr=="") {alert("没有被加密的代码来还原![加密后代码]框中没有内容。"); return; }

 document.F1.S1.value=decodeURIComponent(DecodeStr);

}


function exchange()
{
 if(document.F1.R1[0].checked) encrypt();
 else if(document.F1.R1[1].checked ) decode();
 else alert("没选择“加密/解密”按扭");
}
</script>
</head>

<body bgcolor=#CCD6DF>
<h2 align="center"><font color="#000080">encodeURIComponent 网页加密</font></h2>
<form name="F1" action="" target="_blank" onsubmit="exchange(); return false;">
 <div align="center">
 <table border="1" width="860" id="table1" height="213" bordercolorlight="#C0C0C0" bordercolordark="#808080">
  <tr>
   <td width="360" height="28">
   <p align="center"><b><font color="#000080">原始代码</font></b></td>
   <td width="103" height="28"> </td>
   <td height="28">
   <p align="center"><b><font color="#000080">加密后代码</font></b></td>
  </tr>
  <tr>
   <td width="360"><textarea rows="14" name="S1" cols="50"></textarea></td>
   <td width="103">
   <p align="center"><input type="radio" name="R1" checked>加密</p>
   <p align="center"><input type="radio" name="R1">解密</p>
   <p align="center"><input type="submit" value="<-执行->" name="B1"></p>
   </td>
   <td><textarea rows="14" name="S2" cols="50"></textarea></td>
  </tr>
  <tr>
   <td colspan="3"><br>
   <font face="宋体" color="#0000ff">&lt;HTML&gt;<br>
   &lt;HEAD&gt;<br>
   &lt;meta http-equiv=&quot;Content-Language&quot; content=&quot;zh-cn&quot;&gt;<br>
   &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=gb2312&quot;&gt;<br>
   &lt;title&gt;加密&lt;/title&gt;<br>
   &lt;script LANGUAGE=&quot;Javascript&quot;&gt;document.write(unescape(&quot;<b><font color="#CC0000">[加密后代码]</font></b>&quot;))&lt;/SCRIPT&gt;<br>
   &lt;/HEAD&gt;<br>
   &lt;BODY&gt;<br>
   &lt;/BODY&gt;<br>
   &lt;/HTML&gt;</font><br>
 </td>
  </tr>
 </table>
 </div>
</form>
</body>
</html>

发表于 @ 2006年12月04日 17:53:00|评论(loading...)

新一篇: 140网页配色测试页V3.4(最终版)源码 | 旧一篇: 初涉VB.NET入门级代码积累

Csdn Blog version 3.1a
Copyright © 双色心