PDA

View Full Version : Javascript



Soulpieced
11-16-2003, 08:54 PM
Arg, I hate this regular expression garbage. Here's my assignment.

Prompt the user for a ZIP code and a country code. If the country code is "US," it checks to see if the ZIP code is a valid US ZIP code. If the country code is "CA," it checks to see if the ZIP code is a valid Canadian ZIP code. Canadian ZIP codes have the form "ANA NAN" where A is any letter and N is any digit. You may use regular expressions or string methods. Have the program tell the user whether the ZIP code is valid in an alert box.