<script>
document.getElementById("verify").onclick = function() {
var a = /^[\u4e00-\u9fa5]+$/ //判断条件
var name = document.getElementById("name1").value//获取标签的内容
var isName = a.test(name)//检测获取内容是否匹配
var b = /^[\0-9a-zA-Z_]+$/
var pass = document.getElementById("pass1").value
var isPass = b.test(pass)
var c = /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/
var Mail = document.getElementById("Mail1").value
var isMail = c.test(Mail)
var d = /^[1-9]\d*$/
var Integer = document.getElementById("Integer1").value
var isInteger = d.test(Integer)
if (isName) {//判断是否正确,正确就继续判断
if (isPass) {
if (isMail) {
if(isInteger){
alert("验证成功")
}else {
alert("年龄格式不正确")
}
} else {
alert("邮箱格式不正确")
}
} else {
alert("密码格式不正确")
}
} else {
alert("姓名格式不正确")
}
}
</script>