Got JS but need to add a redirect to it. Please help!
It's basically a zip code form submit where the user types in their zip code then hits submit.
However, after they hit submit I would like to redirect them to another page.
I've included the code below:
HEADER:
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Brian Swalwell -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! JavaScript Source: Free JavaScripts, Tutorials, Example Code, Reference, Resources, and Help -->
<!-- Begin
function validateZIP(field) {
var valid = "0123456789-";
var hyphencount = 0;
if (field.length!=5 && field.length!=10) {
alert("Please enter your 5 digit or 5 digit+4 zip code.");
return false;
}
for (var i=0; i < field.length; i++) {
temp = "" + field.substring(i, i+1);
if (temp == "-") hyphencount++;
if (valid.indexOf(temp) == "-1") {
alert("Invalid characters in your zip code. Please try again.");
return false;
}
if ((hyphencount > 1) || ((field.length==10) && ""+field.charAt(5)!="-")) {
alert("The hyphen character should be used with a properly formatted 5 digit+four zip code, like '12345-6789'.
Please try again.");
return false;
}
}
return true;
}
// End -->
</script>
BODY:
<center>
<form name=zip onSubmit="return validateZIP(this.zip.value)">
Zip Code: <input type=text size=20 name=zip>
<input type=submit value="Submit">
</form>
</center>
Could someone tell me where to put the URL I want to redirect the user to?
And if possible, is there a way to take the zip code they submitted and forward it to the new URL?
So it would say something like:
Your zip code (77120) is still available. Act fast!
Thanks.
-- Lisa G
-- Lisa G
-- Lisa G