<! DOCTYPE html>
<meta charset= "UTF-8" >
<title></title>
<style>
body{margin:0;padding:0;}
. label{float:left;width:120px;}
. infobox{width:200px;}
. error{color:red;padding-left:10px;}
. submit{margin-left:125px;margin-top:10px;}
</style>
<script src= "Jquery-1.7.1.min.js" ></script>
<body>
<form id= "sign_up" method= "post" action= "enctype=" Multipart/form-data ">
<div><span>enter age</span>
<input name= "Age" type= "text" maxlength= "/>"
<span></span>
</div>
</form>
<script>
$ (". Infobox"). On ("Blur", function (event) {
Yanzheng (". Error", ". Infobox", event);
});
function Yanzheng (classnamehide,inputval,event) {
var data = $ (inputval). Val ();
var test_express =//;
(Data.indexof ("@") >0)? (function () {
test_express =/^\w+ ([-+.] \w+) *@\w+ ([-.] \w+) *\.\w+ ([-.] \w+) */;
TestFunction (test_express);
}) ():(function () {
test_express =/^ (13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8| 9]|18[0|1|2|3|5|6|7|8| 9]) \d{8}$/;
TestFunction (test_express);
})();
function TestFunction (test_press) {
(Test_press.test (data))? (function () {
$ (classnamehide). Text ("");//Error hint Hide
}) ():(function () {
$ (classnamehide). Text ("Your input format does not conform to the rules");//Error prompt display
Event.preventdefault ();
})()
}
}
</script>
</body>
Example of verifying email and mobile account