Modification to email validation script

wxdqz

New Member
The email form validation script at <!-- m --><a class="postlink" href="http://javascript.internet.com/forms/check-email.html">http://javascript.internet.com/forms/check-email.html</a><!-- m -->
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:
 
Back
Top