One of the simplest of this mailbox authentication does not verify mailbox length and legality, such as input "I'm @fdd." Hello, yes, you can.
| The code is as follows |
Copy Code |
function Is_email (str) {if (Str.indexof ("@") ==-1) | | (Str.indexof (".") ==-1)) {
return false; } return true; } |
The above example simply determines if the user has entered a character that has @ and "." If not, then the email address is not valid, so if I enter
| The code is as follows |
Copy Code |
Fdafafsfsafdsa@fsafdsa@.fafdafsa
|
This can also be verified by the following, we use validation to do a mailbox verification
| The code is as follows |
Copy Code |
| function Test () { var temp = document.getElementById ("Text1"); //Validation 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 (!myreg.test (temp.value)) { alert (' Tip NN Please enter a valid e_mail! '); Myreg.focus (); return false; } } |
It's a little bit stronger than the top, and he can pass.
| The code is as follows |
Copy Code |
Fsafsa@fafa.fdsf
|
This can also be verified if we want to enter only as abc@qq.com
| The code is as follows |
Copy Code |
var emailreg = "/^w+ (-w+) | (. w+)) *@[a-za-z0-9]+ ((. | -) [a-za-z0-9]+] *. [a-za-z0-9]+$/]; var ee = "xwz@126.com"; var rege = new RegExp (Emailreg); |
This is probably OK, because there are too many domain names, so we do not need to limit the suffix.