سؤال

I've currently created this code to check for an array (For the Login) before moving to the next array to corroborate the password. For some reason, there's a specific instance within the code preventing a javascript prompt or alert box from popping up. I've done trial and error and it appears to be an issue with the while statement overall. But, further testing is not revealing anything obvious.

while(loginSelection != true)
{
    alert("Welcome to the Ballot Design Process");
    var loginUsername = prompt("Please enter in your username: ");

        for(checkFor; checkFor <= userID.length; checkFor++)
        {
            if(loginID == userID(count))
            {   
                if(user_password == password(checkFor)
                {
                    loginPassword = prompt("Please enter in your password: ");
                }
            }
            else
            {
                arrayPos += 1;

                if(arrayPos == userID.length-1)
                    alert("Sorry, you did not enter a correct identification.");
            }
        }

}
هل كانت مفيدة؟

المحلول

You are missing a closing bracket on your if statement:

 if(user_password == password(checkFor)) <<<<<

I recommend checking your javascript code with something like http://www.jshint.com if your debugger/IDE isnt picking it up.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top