'conditional statment in prompt
I'm working on providing a user with two different pictures depending on the right username/password. I'm having a prompt popup for the user to give the username/password and after providing the right credentials the login picture should appear and if the credentials are wrong the logout picture should appear. I am using the getElementById to change accordingly. At this moment the prompt shows up, but there is no picture showing.
<img src="user_in.PNG" id="user_in_id" hidden>
<img src="user_out.PNG" id="user_out_id" hidden>
<script>
var person = prompt("Please enter your name", "");
var password = prompt("Please enter your password", "");
if (person == "admin" && password =="admin") {
alert("Welcome, You are now Logged in");
document.getElementById("user_in_id");
}else
alert("wrong username or password");
document.getElementById("user_out_id");
</script>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
