I'm a novice in javascript and I'm having trouble with basic stuff. I'm trying to link a javascript function to a html file to validate a login. I want it to only validate 2 email and password combos and direct to another page (index.html) or pop-up an alert if anything else is entered. I think I'm headed in the right direction with my codes but i dont think I'm calling the function properly because it's not doing anything when i enter an email and password. The code I have is below, if anyone can help i would greatly appreciate it. Thanks for your help.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Home</title>
<script type="text/javascript" src="login.js"></script>
</head>
<body>
<form method="post" name="login" >
Email Address: <input type="email" id="email" name="email" required autofocus ><br><br>
Password: <input type="password" id="password" name="password" required><br><br>
<input type="submit" value="Submit" onsubmit="validate()">
</form>
</body>
</html>

-------------------------------------------------------------------------------------------

function validate(email1, password1, email2, password2)
{


var email1=document.login.email.value;
var email2=document.login.email.value;
var password1=document.login.password.value;
var password2=document.login.password.value;
}
}
if ((email1==username@yahoo.com) && (password1==apple1) || (email2==user2@yahoo.com) && (password2==apple2)){

return 'index.html'
}

else alert("Email or password is incorrect, please try again");