Here is the Question in two parts:
I am having problems creating a zip-code look-up in javascript. The first part is
1) having javascript recongnize that a zip-code is linked to a state, and possibly maintain that data. The second part is to
2) Have the javascript output the state in the second field text "State Result" which is displayed to the user.
The script and site can be found here:
Edit fiddle - JSFiddle[
^](This contains the entire code, and is not a download. Pasted on JSFiddle as the full code is too long for CodeProject. Similar to pastebin).
References to Nodes, External Websites (posting an external site for examples is okay, linking in code is not), PhP, SQL Databases, external Program downloads,extensions, are unfortunately not allowed. This script consist of using the HTML/Javascript languages only.
-----Here is part of the javascript----:
function validateZIP(zipfield, statefield) {
var valid = "0123456789-";
var hyphencount = 0;
What I have tried:
function GetZip(90001, 90002){
return California, California
}
document.getElementById("")=GetZip (9001, 9002)
As seen above, I am attempting to use an object to call California by 9001 with the value return being California to the user on a single page.
I have tried the concept of functions, however dictionaries is a new concept.
There are many zipcodes I need a shorter and cleaner/easier way of calling zip-codes to be searched on the site with the output as corresponding states.