I have a script on this page
[url]http://www.jacobjacobi.com/starch/files/index.html
There is a “zip code locator” script that I use so when someone enters a zip code it will let you know if service is available in that area. However, the script only activates if you click the “Check” button, and I also want it to work when the enter button is clicked. Any ideas on what I need to change?
Here is the script:
// JavaScript Document
function checkZip(){
var zipField = document.zipcode.zip.value;
//I gave the form a name “zipcode”
var zipCode = new Array(23)
zipCode[0] = “30080”;
zipCode[1] = “30305”;
zipCode[2] = “30306”;
zipCode[3] = “30308”;
zipCode[4] = “30309”;
zipCode[5] = “30312”;
zipCode[6] = “30318”;
zipCode[7] = “30324”;
zipCode[8] = “30325”;
zipCode[9] = “30326”;
zipCode[10] = “30327”;
zipCode[11] = “30332”;
zipCode[12] = “30333”;
zipCode[13] = “30339”;
zipCode[14] = “30342”;
zipCode[15] = “30347”;
zipCode[16] = “30355”;
zipCode[17] = “30357”;
zipCode[18] = “30361”;
zipCode[19] = “30379”;
zipCode[20] = “31106”;
zipCode[21] = “31107”;
zipCode[22] = “31126”;
for(i=0;i<zipCode.length;i++){
if (zipField == zipCode[i]) {
//I added a for loop to run through the zipCode Array
document.getElementById(‘zipResult’).innerHTML = ‘<span class=”copy”>Great news! We service your zip code. Get started and <a href=”schedule_pickup.html”>schedule a pick-up</a>.</span>’;
break;
} else {
document.getElementById(‘zipResult’).innerHTML = ‘<span class=”copySmall”>Unfortunately we do not service your zip code at this time. However join our <a href=”contact_us.html”>mailing list</a>, and we will let you know as soon as service becomes available in your area.</span>’;
}
}
}