|
-
Aug 5th, 2003, 06:40 PM
#1
Thread Starter
Hyperactive Member
Formating a text field with JavaScript
I am working on my website and I have ran into a problem. I have a online order form, where I have everything working except the zip code field. In the zip code, all that I have is a text box field, what I need is my Javascript to do the following. When numbers are entered into the field I would like the code to check what was entered:
if it was a 5 number zipcode, leave it alone
if it was a character(s) and then numbers(for international orders) just leave it alone
if it was a 5 number zipcode + the 4 digit extension for the zip code, (ex. 15455 1564), I need the program to check if there was a '-' between the zip and the extension if there wasnt then insert a hypen inbetween thenumbers (ex. 15455-1564).
Also check if all the numbers were together (ex. 154551564), if this is the case separate the numbers and put a hyphen in between the numbers.
If anyone could provide me with some code or expain how to do this, I would greatly appreciate it.
Thanks to all that reply.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|