no alert is coming.
I have updated the code
so you can debug it
Part of html:-
<form method="POST" name="main_form" onsubmit="return login()">
<input type="email" name="email">
<input type="password" name="pwd">
<input type="submit">
</form>
JS function:-
function login() {
var email = document.main_form.email.value;
var pwd = document.main_form.pwd.value;
if (email == 'example@example.com' && pwd == 'example123') {
sessionStorage.setItem("email", email);
window.location.href = './index.html';
} else {
alert('Wrong');
}
return false;
}
Aucun commentaire:
Enregistrer un commentaire