javascript教程使用者註冊密碼強度驗證程式
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "HTTP://www.w3.org/ tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="HTTP://www.jzread.com/1999/xhtml">
<head >
<meta HTTP-equiv="content-type" content="text/html; charset=gb2312" />
<script language="javascript教程">
password
var tmp=document.regform.u_password.value;
if (tmp.length < 6){
alert ("提示:nn密碼長度必須大於6");
document.regform.u_password.focus();
return false;
}
if ( tmp.length <6 ){ // && /^d+$/.test(tmp)
alert ("提示:n密碼過於簡單,請設置字母、數位或符號的組合。 ");
document.regform.u_password.focus();
return false;
}
if (document.regform.u_password2.value != document.regform.u_password.value){
alert ("提示:nn兩次密碼不一致");
document.regform.u_password2.focus();
return false;
}
</script>
</head>
<body>
<form id="form1" name="regform" method="post" action="">
<label>
輸入密碼:
& lt;input type="password" name="u_password" />
確認密碼:
<input type="password" name="u_ password2" />
</label>
<label>
<input type="submit" name="submit" value="驗證" onclick="checkpass();" />
</label>
</form>
</body>
</html>