Form Verification-Email verification, form verification email

Source: Internet
Author: User
Tags email account

Form Verification-Email verification, form verification email

Email Verification

1. Using function Functions

Note: You need to add the attribute onblur = "loginEmailBlur (this. value)" to the <input> tag of the Code )"

Function loginEmailBlur (strEmail) {var loginEmail = $. trim ($ ("input [name = 'email ']"). val (); if (loginEmail = null | loginEmail = 'mail' | loginEmail = "") {$ (". smtwarning "). empty (). text ("your email account forgot to enter");} else {if (strEmail. search (/^ \ w + (-\ w +) | (\. \ w +) * \ @ [A-Za-z0-9] + ((\. |-) [A-Za-z0-9] + )*\. [A-Za-z0-9] + $ /)! =-1) {$ (". smtwarning "). empty (); return true;} else {$ (". smtwarning "). empty (). text ("enter the correct email format ");}}}

2. Write in $ (document). ready (function ()

// Form Verification in the login box var $ loginEmail = $ ("input [name = 'email ']"); var $ export warning = $ (". smtwarning "); $ loginEmail. blur (function () {var loginEmail = $. trim ($ ("input [name = 'email ']"). val (); if (loginEmail = null | loginEmail = 'mail' | loginEmail = "") {$ export warning. empty (). text ("your email account forgot to enter");} else {if (loginEmail. search (/^ \ w + (-\ w +) | (\. \ w +) * \ @ [A-Za-z0-9] + ((\. |-) [A-Za-z0-9] + )*\. [A-Za-z0-9] + $ /)! =-1) {$ warning. empty (); return true;} else {$ export warning. empty (). text ("enter the correct email format ");}}});


 


How to write code for email verification in js Form Verification

1,
Else if (document. getElementById ("email "). value. replace (// g ,""). search (/^ \ w + (-\ w +) | (\. \ w +) * \ @ [A-Za-z0-9] + ((\. |-) [A-Za-z0-9] + )*\. [A-Za-z0-9] + $/) =-1)
{
If (document. all)
{
Alert ('Enter the correct Email address ');
Event. returnValue = false;
}
Else
{
Alert ('Enter the correct Email address ');
Event. preventDefault ();
}
}
2,
3,
4,

Js Form Verification

// Check the mailbox function isEmail (str) {var reg =/^ ([a-zA-Z0-9 _-]) + @ ([a-zA-Z0-9 _-]) + ((\. [a-zA-Z0-9 _-] {2, 3}) {1, 2}) $/; return reg. test (str );}
// Password:
<Html>

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.