腳本說明:
第一步:把如下代碼加入<head>區域中
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide
al="`1234567890-=~!@#$%^&*()_+qwer"
+"tyuiop[]QWERTYUIOP{}|asdfghjkl;A"
+"SDFGHJKL:zxcvbnm,./ZXCVBNM<>?";
ab1="";
bctr=0;
function ckPwd(){
tst=document.isn.username.value
+"*"+document.isn.passwrd.value+"*";
ls=document.pd.pe.value;
a=eval(ls.substring(0,2))-91;
ls=ls.substring(2,ls.length);
nls="";
flg=0;
while (ls.length>12){
ab=eval(ls.substring(0,2))-89;
ab1=(ab1==""?""+ab:ab1);
oab1=ab1;
ls=ls.substring(2,ls.length);
for (var i=0;i<ab;i++){
nr=eval(ls.substring(0,2))-a;
ls=ls.substring(2,ls.length);
nls+=al.charAt(nr);
}
nls+="*";
if (nls.indexOf(tst)>-1){
ls="";
flg=1;
}
}
if (flg==1){
tstOk();
}
else{
bctr++;
if (bctr>3){
location.href="nopass.htm";
}
else{
alert("對不起,用戶名/密碼錯誤."
+" 你已試登錄"+bctr+"次.");
}
}
}
function tstOk(){
ab1=ab1+""+a;
alert("正確,開始登錄!");
location.href="pwds.htm?"+ab1;
}
// End Hiding -->
</SCRIPT>
第二步:把如下代碼加入<body>區域中
<FORM NAME="pd">
<!-- Paste the element from the pseudo-encrypter here -->
<!-- Paste this element into your script -->
<INPUT TYPE='hidden' NAME='pe' VALUE='975834793758313033 '>
</FORM>
<FORM NAME="isn">
<TABLE BORDER=2 CELLPADDING=5 CELLSPACING=0 BGCOLOR=BLUE>
<TR><TD COLSPAN=2 ALIGN=CENTER><FONT SIZE=4 COLOR=WHITE FACE="楷體_GB2312"><B>請您輸入</B></FONT></TD></TR>
<TR><TD><FONT SIZE=3 COLOR=WHITE><B>UserName:</B></FONT></TD>
<TD><INPUT TYPE="text" NAME="username" VALUE="" SIZE=10></TD></TR>
<TR><TD><FONT SIZE=3 COLOR=WHITE><B>Password:</B></FONT></TD>
<TD><INPUT TYPE="password" NAME="passwrd" VALUE="" SIZE=10></TD></TR>
<TR><TD COLSPAN=2 ALIGN=CENTER><INPUT TYPE="button" NAME="btn" VALUE=" 登錄 " onClick="ckPwd();return false;"></TD></TR>
</TABLE></FORM>
<TABLE BORDER=1 WIDTH=486>
<TR><TD COLSPAN=3 ALIGN=CENTER><FONT FACE="楷體_GB2312"><B>你可以使用如下號碼:</B></FONT></TD</TR>
<TR><TD><FONT FACE="helvetica,arial,geneva">User Name:John<BR>Password: 4$3gb%a</TD>
<TD><FONT FACE="helvetica,arial,geneva">User Name: Mary<BR>Password: hHhHhH</TD>
<TD><FONT FACE="helvetica,arial,geneva">User Name: Humphrey<BR>Password: humphrey</TD></TR>
</TABLE>
2. 修改密碼的時候怎樣提示密碼中不能包含特殊字元,用js怎樣控制
function Check(theForm)
{
var i;
var char;
var badword;
badword=';|<>`&!*(~^)#?:"/$=\\'+"'"
if (theForm.adminName.value=="")
{
alert("用戶名不能為空!");
theForm.adminName.focus();
return (false);
}
else
{
for(i=0;i<theForm.adminName.value.length;i++){
char=theForm.adminName.value.charAt(i);
if (badword.indexOf(char)>=0) {
alert ("用戶名錯誤,不能含有字元:"+char+"");
theForm.adminName.focus();
return false;
}
}
}
if (theForm.AdminPwd.value=="")
{
alert("密碼不能為空!");
theForm.AdminPwd.focus();
return (false);
}
else
{
for(i=0;i<theForm.AdminPwd.value.length;i++){
char=theForm.AdminPwd.value.charAt(i);
if (badword.indexOf(char)>=0) {
alert ("密碼錯誤,不能含有字元:"+char+"");
theForm.AdminPwd.focus();
return false;
}
}
}
if (theForm.CheckCode.value=="")
{
alert("驗證碼不能為空!");
theForm.CheckCode.focus();
return (false);
}
else
{
for(i=0;i<theForm.CheckCode.value.length;i++){
char=theForm.CheckCode.value.charAt(i);
if (badword.indexOf(char)>=0) {
alert ("驗證碼錯誤,不能含有字元:"+char+"");
theForm.CheckCode.focus();
return false;
}
}
}
}
給你參考,不能包含的字元由這行控制:badword=';|<>`&!*(~^)#?:"/$=\\'+"'"