Okay friends,
I've put together (well at least made an attempt) my very first JavaScript, and it's not working. I'm reading the JavaScript Bible, but I'm still confused.
You can view it (not working), at:
http://www.jacobjacobi.com/starch/files/index.html
----------------------------------------------------------------------------------------
Here's the bottom line. I've created a small zip code checker on my home page that will tell customers if service is available in their zip code. Immediately to the right of the zip code checker box, text will populate (but it doesn't) indicating whether service is available or not. So I can't figure out where I went wrong? I'm getting JavaScript error on line 3? Anybody have an idea what I did wrong?
Here's my script:
<script type="text/javascript">
<!--
function checkZip()
var zipField = document.getElementID("zip").value;
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";
if zipField == zipCode {
document.getElementById('zipResult').innerHTML = 'Great news! We service your zip code. Get started
and <a href="schedule_pickup.html">schedule a pick-up</a>.';
}
else {
document.getElementById('zipResult').innerHTML = '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.';
}
// -->
</script>
---------------------------------------------------------------------------
Here's my HTML for the header:
<script type="text/javascript" language="Javascript1.2" src="checkzip.js"></script>
--------------------------------------------------------------------------
Here's my HTML for the form:
<form><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="38%"><table width="115" height="50" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="114" valign="middle" background="../images/zipcheck2.gif">
<table width="105" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><input name="zip" type="text" id="zip" size="5" maxlength="5"></td>
<td align="center"><a href="#"><img src="../images/check.gif" width="36" height="12" border="0" type="submit" onClick="checkzip()"></a></td>
</tr>
</table></td>
</tr>
</table>
</td>
<td width="62%" valign="top" id="zipResult"></td>
</tr>
</table></form>