Code for validating email in javascript

I want to validate the E mail Address as soon as it is entered in a text box and the focus is changed to some other place in my web page.

Description: A script that closely examines the content of a form box to ensure that the user entered a valid email address.

code for validating email in javascript-55code for validating email in javascript-12code for validating email in javascript-55

As web developers, we want to protect the information filled out in form fields.

Here is an example page that does all of this for you.

Text Box 1 is for single emails and Text Box 2 validates multiple emails.

If not, the form submition is canceled, and the surfer prompted to re-enter a valid address.

The script makes the following assumptions regarding what a valid email address is: -Contains a least one character procedding the "@" -Contains a "@" following the procedding character(s) -Contains at least one character following the "@", followed by a dot (.), followed by either a two character or three character string (a two character country code or the standard three character US code, such as com, edu etc) Note that this script requires NS 4 or IE 4 to function- all other browsers will simply not participate in the form validation process.

Leave a Reply