<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>无标题文档</title> <script language=vbscript> Function str2bin(varstr) str2bin="" For i=1 To Len(varstr) varchar=mid(varstr,i,1) varasc = Asc(varchar) If varasc<0 Then varasc = varasc + 65535 End If If varasc > 255 Then varlow = Left(Hex(Asc(varchar)),2) varhigh = right(Hex(Asc(varchar)),2) str2bin = str2bin & chrB("&H" & varlow) & chrB("&H" & varhigh) Else str2bin = str2bin & chrB(AscB(varchar)) End If Next End Function sub checkuser() a=document.form1.pass.value document.form1.pass.value=str2bin(a) msgbox(a) form1.submit end sub </script> </head> <body> <form name="form1" method="post" action="4.asp"> <table width="90%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><input name="username" type="text" id="username"> </td> </tr> <tr> <td><input name="pass" type="password" id="pass"> <input name="text1" type="text" id="text1"></td> </tr> <tr> <td><input type="submit" name="Submit" value="提交" onClick="checkuser()"> </td> </tr> <tr> <td> </td> </tr> </table> </form> </body> </html>
如果大家有更好的加密方法,请回复一下,上继方法,最好配和网页加密一起使用,己取得更好的效果,由于编写匆忙,偌有什么不足之处,请大家给予指点。