[thelist] js for zip code validation

todea thelist at lists.evolt.org
Mon Dec 9 16:27:01 2002


Can someone help out with som js form validation. I want to validate a zip
code entered by the user against a list of existing zip codes.

I'm trying to do it like this with a few zip codes in an array. But this
doesn't work.


function validate()
{
znum=new Array("10010","90534")
txt=document.eform.jnumber.value
if (txt == znum)
 {
 alert("good")
 return true
 }
else
 {
 alert("Error wrong zip")
 return false
 }
}