| To achieve the source code: <meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/> <script type= "Text/javascript" src= "/public/js/jquery.min.js" ></script> <script type= "Text/javascript" > $ (function () { $ ("#ck_mobile"). Click (function () { var mobile = $ ("#mobile"). Val (); if (!check_mobile (mobile)) { Alert ("Mobile phone number format is not correct http://www.111cn.net"); }else{ Alert ("Mobile phone number is correct"); } }); $ ("#ck_email"). Click (function () { var email = $ ("#email"). Val (); if (!check_email (email)) { Alert ("Incorrect email format"); }else{ Alert ("email correct"); } }); }) Check your phone number. function Check_mobile (MOBILE) { if (mobile.length!= | | | isNaN (MOBILE)) { return false; } Mobile = Mobile.substr (0,3); Number paragraph var HD = new Array (' 130 ', ' 131 ', ' 132 ', ' 133 ', ' 134 ', ' 135 ', ' 136 ', ' 137 ', ' 138 ', ' 139 ', ' 150 ', ' 151 ', ' 152 ', ' 153 ', ' 154 ', ' 155 ' , ' 156 ', ' 157 ', ' 158 ', ' 159 ', ' 180 ', ' 181 ', ' 182 ', ' 183 ', ' 184 ', ' 185 ', ' 186 ', ' 187 ', ' 188 ', ' 189 '; var i = hd.length; while (i--) { if (hd[i] = = Mobile) { return true; } } return false; } Verify that the mailbox is correct function Check_email (email) { var reg =/^ ([a-za-z0-9]+[_|_|.]?) *[a-za-z0-9]+@ ([a-za-z0-9]+[_|_|.]?) *[a-za-z0-9]+. [A-za-z] {2,3}$/; if (!reg.test (email)) { return false; }else{ return true; } } </script> <p> Mobile Number: <input type= "text" id= "mobile"/> <input type= "button" value= "Verify mobile Number" id= "Ck_mobile"/></p > <p>email:<input type= "text" id= "email"/> <input type= "button" value= "Verify mailbox Format" id= "Ck_email"/></p > |