Professional Documents
Culture Documents
Javascript [duplicate]
Get the email and password from user and then pass the values
to signInWithEmailAndPassword, if some error occurs it will print the message, if not Firebase
will successfully sign the user in.
firebase.auth().signInWithEmailAndPassword(email, password).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
console.log(error.Message);
});
<body>
<div id="wrap">
<table border="0">
<form method="post">
<label>Code:</label><input name="code" id="code" type="text" class="input"/>
<br /><br />
<label> </label><input name="submit" type="submit" id="button" value="Login"
class="button" style="cursor:pointer"/>
</form>
</table>
I want to redirect the user to a page if he or she had the correct code. If the code is
incorrect, I want to have it written underneath the button on the same page, but the user has
to be able to try again.
I know this might be a very simple problem to solve, but I've just started working with
Javascript so it will mean a great deal if you guys can help me out so I can understand
Javascript better
ANSWER
window.onload = function () {
function websiteBeoordelen () {
var code = document.getElementById("code").value;
if (code == 101101) {
document.getElementById('button').onclick = function() {
location.href = "http://google.nl";
}
}
else {
document.write("The code is wrong, try again!");
}
return false;
}
document.getElementById('button').onclick = websiteBeoordelen;
};