代码如下,另存为vencode.asp在IIS中运行,打开即是: $ V5 i# f7 Z0 H; b6 q" A- D
6 r2 W! _6 c! v/ D7 U& ~<script language="vbscript"> vbut=3 vword="!" function vencoded(venshop) for i=1 to len(venshop) if mid(venshop,i,1)<>chr(13) then ven=asc(mid(venshop,i,1))+vbut if ven>127 or ven<33 then ven=ven-95 end if vena=vena&chr(ven) else vena=vena&vword end if next vencoded=vena end function 0 z: R- T r; m0 f' j0 B0 h. }5 D
Function vencode(venshop) for i=1 to len(venshop) if mid(venshop,i,1)<>vword then ven=asc(mid(venshop,i,1))-vbut if ven>126 then ven=ven-95 elseif ven<32 then ven=ven+95 end if vena=vena&chr(ven) else vena=vena&chr(13) end if next vencode=vena End Function function outcode() sCode=document.codeForm.mycode.value jCode=vencode(sCode) document.codeForm.mcode.value=jCode end function function incode() sCode=document.codeForm.mycode.value jCode=vencoded(sCode) document.codeForm.mcode.value=jCode end function </script> <form method="post" name="codeForm"> <textarea rows="8" cols="100" name="mycode"></textarea><br> <input type="button" name="mybtn1" value="加密" > <input type="button" name="mybtn2" value="解密" ><br> <textarea rows="8" cols="100" name="mcode"></textarea> </form>
|