<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="format-detection" content="telephone=no">
<meta name="format-detection" content="email=no">
<title>test</title>
<style type="text/css">
ul,li{
}
</style>
<script src="js/jquery-1.9.1.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<form action="">
<ul>
<li> <label for="">中文姓名:</label> <input type="text" name="username" id="username" /> <span class="beizhu"></span></li>
<li> <label for="">姓名拼音:</label> <input type="text" name="usertit" id="usertit" /> <span class="titbz"></span></li>
<li> <label for="">身份证号:</label> <input type="text" name="userid" id="userid" /> <span class="idsbz"></span></li>
<li> <label for="">车牌号:</label> <input name="carNumber" id="chepais" type="text" id="12" onblur="lostBlur();"> <span class="carsbz"></span></li>
</ul>
</form>
<script type="text/javascript">
$('#username').on('blur',function(){
var username = $('#username').val();
re = /^[u4e00-u9fa5]+$/;
if(username == ''){
$('.beizhu').html('请输入姓名');
return false;
}else if(!(re.test(username))){
$('.beizhu').html('请输入正确格式的姓名');
return false;
} else if((re)){
$('.beizhu').html('');
}
});
$('#usertit').on('blur',function(){
var usertit = $('#usertit').val();
re = /^[a-zA-Z]{4,}$/;
if(usertit == ''){
$('.titbz').html('请输入姓');
return false;
}else if(!(re.test(usertit))){
$('.titbz').html('请输入正确格式的姓');
return false;
} else if((re)){
$('.titbz').html('');
}
});
$('#userid').on('blur',function(){
var userid = $('#userid').val();
regIdCard = /(^d{15}$)|(^d{18}$)|(^d{17}(d|X|x)$)/;
if(userid == ''){
$('.idsbz').html('请输入身份证号');
return false;
}else if(!(regIdCard.test(userid))){
$('.idsbz').html('请输入正确格式的身份证');
return false;
} else if((regIdCard)){
$('.idsbz').html('');
}
});
//车牌号验证
//失去车牌号码焦点弹出
function lostBlur(){
var chepais = $('#chepais').val();
var re_car=/^[u4e00-u9fa5]{1}[A-Z]{1}[A-Z_0-9]{5}$/;
if(chepais == ''){
$('.carsbz').html('请输入车牌号');
return false;
}else if(!(re_car.test(chepais))){
$('.carsbz').html('请输入正确格式的车牌号');
return false;
} else if((re_car)){
$('.carsbz').html('√');
}
}
//
</script>
</body>
</html>