Sure this is a simple problem but I am new to this. Am trying to develop a simple website for a user to work out a password and then if they get it right, take them to a congrats screen where they win a prize. However my if statement is not working in the code below
<script>
function CheckPassword() {
var pword = document.getElementById("inpPassword").value;
if (pword == ""|| pword == NULL) {
alert("Please enter a password");
} else if (pword == 'newman') {
window.open('congratulations.html', '_self');
} else {
alert("Wrong password");
}
}
</script>
If I add an alert with the pword value then it prints out correctly what was entered. However the code picks up when the password input is blank, however if the input field is not blank then it does not go to the other screen or show the wrong password alert box. I have tried it with an alert box saying correct instead of the link to the new page but still did not work. Also tried using String(pword) in case that was the problem. Am sure this is a simple solution but just can't see it.
Thanks
if (pword == "" || pword == null)isif (!pword)