What expression that is best use for validating syntax for email and zip-codes (US and canada)
this is what i got for email:
[code]
if (zForm.email.value != (/^(w+@)([a-z0-9-]{2,}.[a-z]{2,})$/i)) {
error += “- Please enter a valid e-mail address n”
}
its in a function and called on the onSubmit event… but no matter what email address i use it never works…
and for the zip-code i got
[code]
if (zForm.zipcode.value != /^(d{5}){1}((-d{4})?)$ ) {
error += “- Please enter a valid zip n”
}
that for us zips with the optional 4 extra numbers… or at least in theroy… same as before in a function and onSubmit event… what I need to know is why they don’t work, for one. and for two whats the expression for canadian zips?
of couse something like php might be better to validate with… but i don’t know php… i barely know JavaScript… (as u can see)…
any ideas??