Thread: Looping help.
View Single Post
Old 01-11-2013, 07:18 PM   PM User | #1
diceman93
New to the CF scene

 
Join Date: Jan 2013
Posts: 6
Thanks: 2
Thanked 0 Times in 0 Posts
diceman93 is an unknown quantity at this point
Looping help.

Hey guys, i'm fairly new to programming in Javascript.
I've been trying to write a basic user name and password program.
I was wondering if I could get some help with how I would put it in a loop so if the information in incorrect, it will prompt up "x" amount of times until the information is correct. Thanks, here's what I have so far.

var user_name = prompt ("Please enter your username: ");
var password = prompt ("Please enter your password: ");

if( (user_name=="John123") && (password== "helloworld") ){
alert("Welcome, " + user_name + ".");
}
else{
alert (" Sorry, information invalid. " );
}

Last edited by diceman93; 01-11-2013 at 07:49 PM..
diceman93 is offline   Reply With Quote