I wrote this small thing to check to make sure a zip code was valid. correct leingth, no letters, etc. The small problem is that when someone enters a zip starting with a zero it gives the onblur "your zip is too short" message. Anyone know how i could test an int that starts with a zero and not have the browser think its only 4 digits? I was either thinking of keeping it a string and checking for 5 characters, but i'm not really sure how to do that. the code i have now is:
Code:
function zipCheck(x)
{
myInt = x.value;
if ((myInt + 1)>0)
{
if (myInt < 10000)
{
alert("Your number wasnt long enough");
}
}
else{ alert("That is not a valid zip code"); }
}
|