JS Email verification, JS judgment email, mailbox/mailbox format verification

Source: Internet
Author: User

function Ismail (name)/e-mail value detection
{
if (! Isenglish (name))
return false;
i = Name.indexof ("at");
j = Name Dot LastIndexOf ("at");
if (i = = 1)
return false;
if (i!= j)
return false;
if (i = = Name dot length)
return false;
return true;
}


jquery Verification Mailbox

function Checkemail ()
{
var temp = document.getElementById ("Tbemail");//This sentence can be replaced with the following
var temp = $ ("#tbemail");
Verification of e-mail
var myreg =/^ ([a-za-z0-9]+[_|_|.]?) *[a-za-z0-9]+@ ([a-za-z0-9]+[_|_|.]?) *[a-za-z0-9]+. [A-za-z] {2,3}$/;
if ($ (' #tbemail '). val () = "")
{
Alert ("input email");
}
Else
{
if ($ (' #tbemail '). Val ()!= "")
{
if (!myreg.test (' #tbemail '). Val ())
{
Alert (!myreg.test (Temp.value));
Alert (' Prompt Please enter a valid e_mail! ');
Tbemail.focus ();//bob this sentence is wrong, the reason is not specified tbemail is that, JS Error said there is no definition of tbemail. Change it to the following line OK.
$ (' #tbemail '). focus ()//the cursor to the input box
return false;
}
else{
Alert ("Good Mail");
}
}
}
}



Method Three

** 
    * Check for e-mail  
    * 
  &nbs P * @param {} 
    *            str  
    * @return {Boolean} true: E-mail,false:<b> is not </b> e-mail; 
  & nbsp */ 
    this.isemail = function (str) {  
      & nbsp var re =/^ ([a-za-z0-9]+[_|-|.]?) *[a-za-z0-9]+@ ([a-za-z0-9]+[_|-|.]?) *[a-za-z0-9]+. [A-za-z] {2,3}$/;  
        return re.test (str);  
    }  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.