Ich muss sicherstellen, dass er mit einem Z
hat mindestens 8 Zeichen und ein *
. Betrachten Sie diese Funktion:
function validatePassword()
{
var strPassword
//Request user enter their password then check its validity
strPassword = prompt("Please Enter A Valid Password","");
while ((strPassword.length <7) || (strPassword.indexOf('*') ==-1) || (strPassword.charAt(0) != 'Z')) {
{
alert("Your password is invalid, \n Please try again")
strPassword = prompt("Please Enter A Valid Password","");
}
//Outcome if password is valid
alert("Your password is valid")
//End while
}
}