Click to See Complete Forum and Search --> : Modification to email validation script


webfavor
01-03-2003, 08:18 PM
The email form validation script at http://javascript.internet.com/forms/check-email.html
prevents entry of emails with TLD's longer than 3 letters. However, the 4-letter TLDs .name and .info are now commonly being used.

I have thus modified the script, changing this:

if (domArr[domArr.length-1].length<2 ||
domArr[domArr.length-1].length>3) {
// the address must end in a two letter or three letter word.
alert("The address must end in a three-letter domain, or two letter country.")

To this:

if (domArr[domArr.length-1].length<2 ||
domArr[domArr.length-1].length>4) {
// the address must end in a two, three, or four letter word.
alert("The address must end in a three or four-letter domain, or two letter country.")

Just thought I would share this. It is pretty easy to figure out, but it is an issue that others may not be aware of)


:rolleyes: