Write a Javascript program that validates if an email is val

Write a Javascript program that validates if an email is valid when user enters address into text box. If incorrect characters are entered, put a line through the incorrect characters and bring up another window for another try at entering the email, throwing an alert when incorrect characters are entered .

Solution

function ValidateEmail(inputText)
{
var mailformat = /^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/;
if(inputText.value.match(mailformat))
{
    document.form1.text1.focus();
    return true;
}
else
{
    alert(\"You have entered an invalid email address!\");
    document.form1.text1.focus();
    return false;
}
}

Write a Javascript program that validates if an email is valid when user enters address into text box. If incorrect characters are entered, put a line through t

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site