+ 2
I need help...
This only runs through half of the script, what could the problem be? Can anyone give me a working copy? My Code: <script> function Login() { var _user = prompt("Enter Your Username"); _user = parseInt(_user); switch (_user) { case Person1: Pass(); break; case Person2: Pass(); break; default: alert("No Such User Exists"); } } function Pass() { var _pass = prompt("Enter Your Password"); _pass = parseInt(_pass); switch (_pass) { case 12345: success(); break; case 54321: success() break; default: alert("Password Was Incorrect"); } } </script> <body> <button onclick="Login()">Login</button> </body>
4 Respostas
+ 4
Person1 and Person2 is not defined. Since you have _user = parseInt(_user); I think the case statements should use integer values (like the cases in your Pass() function.
+ 4
Also, success() is not defined. There's no function called that! Perhaps create one.
+ 4
Its just a couple minor bug fixes besides that
+ 2
Are you kidding? @@
https://www.sololearn.com/Discuss/524362/
https://code.sololearn.com/W7P5ajWImM2f/