I am trying to make a password login page but when you get the password correct, it just alerts the person that it is correct. But I want it to alert and to redirect to another page. For example, google.com. Here is my code, any help would be appreciated.
// Function to check Whether both passwords
// are same or not.
function checkPassword(form) {
password = form.pass.value;
correct = "admin";
// If password not entered
if (password == '')
alert("Please enter Password");
// If confirm password not entered
else if (correct == '')
alert("Please enter confirm password");
// If Not same return False.
else if (password != correct) {
alert("\nPassword is incorrect. Please try again...")
return false;
}
// If same return True.
else {
alert("Password is correct, press okay to continue.")
return true;
}
}
I am very new to coding and got this off of a YouTube Video so I literally don't know anything about JavaScript but I do know about HTML and CSS.