I have a form where it checks the users mail ids for a particular domain like gmail.com
so my code
fstring = document.Request.Email.value;
if (fstring.indexOf('@') > 0) {
if ((fstring.substr(fstring.indexOf('@') + 1, fstring.length) != 'Gmail.com')) {
strErrors = strErrors + 'Not a valid Mail address (must end in @gmail.com)';
}
}
else {
strErrors = strErrors + 'Not a valid Mail address (must end in @Gmail.com),';
}
Now I want to accept the Yahoo.com domain as well what I did was
if (fstring.indexOf('@') > 0)
{
if ((fstring.substr(fstring.indexOf('@') + 1, fstring.length) != 'Gmail.com') || (fstring.substr(fstring.indexOf('@') + 1, fstring.length) != 'Yahoo.com'))
{
strErrors = strErrors + 'Not a valid Mail address (must end in @gmail.com or @yahoo.com)';
}
Go to the complete details ...