window.location.href is not redirecting the user.
I have tried with return true also
Form Code:-
<form method="POST" name="main_form" onsubmit="login()">
<input type="email" name="email">
<input type="password" name="pwd">
<input type="submit">
</form>
Login():-
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';
return false;
Aucun commentaire:
Enregistrer un commentaire