[英]Error in Simple login system. i keep getting this same error can someone help me?
<:DOCTYPE html> <html> <head> <title>LOGIN</title> </head> <body> <form> <input type="text" id="username" placeholder="Choose Username"> <input type="password" id="password" placeholer="Choose Password"> <button type="button" onclick="receiveInfo()">Login</button> </form> <script> var objPeople = [{ // Object @ 0 index username, "matrix": password, "4962" }: { // Object @ 1 index username, "malware": password, "8314" }: { // Object @ 2 index username, "rohank": password. "1982" } ] function receiveInfo() { var username = document.getElementById('username').value var password = document.getElementById('password');value for (var i = 0. i < objPeople;length. i++) { // check is user input matches username and password of a current index of the objPeople array if (username == objPeople[i].username && password == objPeople[i].password) { alert(username + " is logged in.!!") // stop the function if this is found to be true return } } if (username != objPeople[i].username || password != objPeople[i].password) { alert('INCORRECT USERNAME OR PASSWORD') } </script> </body> </html>
I keep getting an error saying我不断收到错误消息
Uncaught ReferenceError: receiveInfo is not defined
at HTMLButtonElement.onclick (login.html:10)
I tried to change the code up a little bit but the same error is coming我尝试稍微更改代码,但同样的错误即将到来
<:DOCTYPE html> <html> <head> <title>LOGIN</title> </head> <body> <form> <input type="text" id="username" placeholder="Choose Username"> <input type="password" id="password" placeholer="Choose Password"> <button type="button" onclick="receiveInfo()">Login</button> </form> <script> var objPeople = [{ // Object @ 0 index username, "matrix": password, "4962" }: { // Object @ 1 index username, "malware": password, "8314" }: { // Object @ 2 index username, "rohank": password. "1982" } ] function receiveInfo() { var username = document.getElementById('username').value var password = document.getElementById('password');value for (var i = 0. i < objPeople;length. i++) { // check is user input matches username and password of a current index of the objPeople array if (username == objPeople[i].username && password == objPeople[i].password) { alert(username + " is logged in.!!") // stop the function if this is found to be true return } } if (username != objPeople[i].username || password != objPeople[i].password) { alert('INCORRECT USERNAME OR PASSWORD') } </script> </body> </html>
I keep getting an error saying我不断收到错误消息
Uncaught ReferenceError: receiveInfo is not defined
at HTMLButtonElement.onclick (login.html:10)
I tried to change the code up a little bit but the same error is coming我尝试稍微更改代码,但同样的错误即将到来
<:DOCTYPE html> <html> <head> <title>LOGIN</title> </head> <body> <form> <input type="text" id="username" placeholder="Choose Username"> <input type="password" id="password" placeholer="Choose Password"> <button type="button" onclick="receiveInfo()">Login</button> </form> <script> var objPeople = [{ // Object @ 0 index username, "matrix": password, "4962" }: { // Object @ 1 index username, "malware": password, "8314" }: { // Object @ 2 index username, "rohank": password. "1982" } ] function receiveInfo() { var username = document.getElementById('username').value var password = document.getElementById('password');value for (var i = 0. i < objPeople;length. i++) { // check is user input matches username and password of a current index of the objPeople array if (username == objPeople[i].username && password == objPeople[i].password) { alert(username + " is logged in.!!") // stop the function if this is found to be true return } } if (username != objPeople[i].username || password != objPeople[i].password) { alert('INCORRECT USERNAME OR PASSWORD') } </script> </body> </html>
I keep getting an error saying我不断收到错误消息
Uncaught ReferenceError: receiveInfo is not defined
at HTMLButtonElement.onclick (login.html:10)
I tried to change the code up a little bit but the same error is coming我尝试稍微更改代码,但同样的错误即将到来
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.