I'm calling a simple e-mail validator in JavaScript as the below shows - this works fine as I'm calling it in my HTMl form as such:
<form name="email" action="mail.php" onsubmit="return SubMail_Validator(this)" method="POST">

Then this code does the validation that an e-mail has been entered - however - I need the validator to then run the window.location.href to route users to another page - and this doesn't happen - it stays on the mail.php page. So ideally - I'm e-mailing the user with the action - and then the onsubmit validates - but then I want users routed to another page:

<script language="JavaScript">
function SubMail_Validator(email)

    if (email.from.value == "")
        alert("Please enter a value for the E-mail field.");
    return (false);

    if (email.from.value.indexOf('@',0 ) == -1) 
        alert("Invalid E-mail Address"); 


  return (true);

  window.location.href = 'my_test_web_site_location';   




The best approach would be to have your 'mail.php' script handle the redirection to 'my_test_web_site_location'. If necessary, you can pass the value of 'my_test_web_site_location' to the script in a 'hidden' <input>. If the script you're using won't let you redirect, there are hundreds of other formmail scripts out there that will do it.

You should also look around for a better email validation JavaScript function. What you have now is barely better than having none at all. You might start by using an HTML 5 <!DOCTYPE> so you can use the new <input> types - one of which is type="email", and if you also set the 'required' attribute, should handle even the newest Top Level Domain Names in email addresses. Good luck!

Thanks! I used in the .php code a

header('Location: http://....') for the re-direct.