JS Authentication Email Address Format Method Summary _javascript Skill

Source: Internet
Author: User

The example of this article describes the method of JS authentication email address format. Share to everyone for your reference, specific as follows:

Example 1:

Copy Code code as follows:
<asp:textbox id= "Txt_email" runat= "Server" onblur= "Checkrate" (this.id) ></asp:TextBox>

function checkrate (input)
{
  var re =/^[_ ". 0-9a-z-]+@ ([0-9a-z][0-9a-z-]+.) {1,4} [A-z] {2,3}$/i;  
  var nubmer = document.getElementById (input). value;
   if (!re.test (Nubmer))
  {
    alert ("Please enter the correct format of the mailing Address");
    document.getElementById (input). Value = "";
    return false;
   }
}

Example 2:

<script type= "Text/javascript" >
function Isvalidmail () {
var textval = document.getElementById ("  TextBox1 "). Value;
var Regex =/^ (?: \ W+\.?) *\w+@ (?: \ W+\.)  *\w+$/;
if (Regex.test (Textval)) {
alert (true);
else {
if (Textval = = "") {
alert ("Please enter your email address!!  ");
return false;
else {
alert ("Hello, you entered incorrectly, please re-enter;");
   document.getElementById ("TextBox1"). Value = "";
return false;
}
}
</script>

Copy Code code as follows:
<asp:textbox id= "TextBox1" runat= "Server" ></asp:TextBox>
<asp:button id= "Button3" runat= "Server" text= "button" onclientclick= "Return Isvalidmail ()" onclick= "Button3_Click "/>

I hope this article will help you with JavaScript programming.

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.