Reputation: 3
I would like to know how to make a JavaScript function link to another site.
Here is my code so far.
var user = "iamauser1"
var pass = "iamauser2"
var userfield = document.getElementByName("UserEntry")
var passfield = document.getElementByName("PassEntry")
var submitbtn = document.getElementByName("SubmitButton")
function checkLogin() {
if userfield == user && passfield == pass {
}
}
What I am aiming to do, just to test this, is to make the above function link to a page that says, 'Login Successful!'. Can anyone help me?
So, I want to make a redirect.
Upvotes: 0
Views: 149
Reputation: 2985
All you need to do is:
window.location.href = 'YOUR URL';
Then the browser will navigate to the URL specified.
Upvotes: 1