|
↑
Forms >>>
This script works like our Password Verifier, however, it also checks for a minimum length and invalid characters.
Add the below code to the <body> section of your page:
<script
language="javascript"
type="text/javascript">
function
validatePwd()
{
var
invalid =
" ";
var
minLength =
6;
var
pw1 =
document.myForm.password.value;
var
pw2 =
document.myForm.password2.value;
if
(pw1
==
''
||
pw2 ==
'')
{
alert('Please
enter your password twice.');
return
false;
}
if
(document.myForm.password.value.length
<
minLength)
{
alert('Your
password must be at least '
+
minLength +
' characters long. Try again.');
return
false;
}
if
(document.myForm.password.value.indexOf(invalid)
>
-1)
{
alert("Sorry,
spaces are not allowed.");
return
false;
}
else
{
if
(pw1
!=
pw2)
{
alert
("You
did not enter the same new password twice. Please re-enter your
password.");
return
false;
}
else
{
alert('Nice
job.');
return
true;
}
}
}
</script>
<form
name=myForm
onSubmit="return
validatePwd()">
Enter your password twice.
<br>
(At least 6 characters, 12 characters
max, and spaces are not allowed.)
<br>
<pre>
Password:
<input
type=password
name=password
maxlength=12>
<br>
Verify password:
<input
type=password
name=password2
maxlength=12>
<br>
</pre>
<input
type=submit
value="Submit">
</form>
|
→ http://www.cashadvance-loans.net/missouri/cash-advance-st-louis-mo/
|