<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="libs/angular.min.js"></script>
<script src="libs/jquery-1.11.0.min.js"></script>
<script>
function checkAll() {
var name = document.getElementById("name").value;
if(name.length >= 2 && name.length <= 8) {
// alert("成功");
} else {
alert("用户名长度不对")
}
var pass = document.getElementById("pass").value;
if(pass.length >= 6 && pass.length <= 10) {
// alert("成功");
} else {
alert("密码长度不对")
}
var age = document.getElementById("age").value;
if(age >= 18 && age <= 99) {
// alert("成功");
} else {
alert("年龄不对")
}
var sex = document.getElementById("sex").value;
if(sex == "男" || sex == "女") {
// alert("成功");
} else {
alert("性别只能输入男女")
}
var sfz = document.getElementById("sfz").value;
if(sfz.length == 18) {
// alert("成功");
} else {
alert("身份证不对")
}
var sjh = document.getElementById("sjh").value;
if(sjh.length == 11) {
// alert("成功");
} else {
alert("手机号不对")
}
}
</script>
</head>
<body>
<div>
<table border="1">
<tr>
<td>姓名:</td>
<td><input type="text" id="name" /></td>
</tr>
<tr>
<td>密码:</td>
<td><input type="text" id="pass" /></td>
</tr>
<tr>
<td>年纪:</td>
<td><input type="text" id="age" /></td>
</tr>
<tr>
<td>性别:</td>
<td><input type="text" id="sex" /></td>
</tr>
<tr>
<td>身份证:</td>
<td><input type="text" id="sfz" /></td>
</tr>
<tr>
<td>手机号:</td>
<td><input type="text" id="sjh" /></td>
</tr>
<tr>
<td>邮箱:</td>
<td><input type="text" id="yx" /></td>
</tr>
<tr>
<td></td>
<td><input type="button" οnclick="checkAll()" value="提交" /></td>
</tr>
</table>
</div>
</body>
</html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="libs/angular.min.js"></script>
<script src="libs/jquery-1.11.0.min.js"></script>
<script>
function checkAll() {
var name = document.getElementById("name").value;
if(name.length >= 2 && name.length <= 8) {
// alert("成功");
} else {
alert("用户名长度不对")
}
var pass = document.getElementById("pass").value;
if(pass.length >= 6 && pass.length <= 10) {
// alert("成功");
} else {
alert("密码长度不对")
}
var age = document.getElementById("age").value;
if(age >= 18 && age <= 99) {
// alert("成功");
} else {
alert("年龄不对")
}
var sex = document.getElementById("sex").value;
if(sex == "男" || sex == "女") {
// alert("成功");
} else {
alert("性别只能输入男女")
}
var sfz = document.getElementById("sfz").value;
if(sfz.length == 18) {
// alert("成功");
} else {
alert("身份证不对")
}
var sjh = document.getElementById("sjh").value;
if(sjh.length == 11) {
// alert("成功");
} else {
alert("手机号不对")
}
}
</script>
</head>
<body>
<div>
<table border="1">
<tr>
<td>姓名:</td>
<td><input type="text" id="name" /></td>
</tr>
<tr>
<td>密码:</td>
<td><input type="text" id="pass" /></td>
</tr>
<tr>
<td>年纪:</td>
<td><input type="text" id="age" /></td>
</tr>
<tr>
<td>性别:</td>
<td><input type="text" id="sex" /></td>
</tr>
<tr>
<td>身份证:</td>
<td><input type="text" id="sfz" /></td>
</tr>
<tr>
<td>手机号:</td>
<td><input type="text" id="sjh" /></td>
</tr>
<tr>
<td>邮箱:</td>
<td><input type="text" id="yx" /></td>
</tr>
<tr>
<td></td>
<td><input type="button" οnclick="checkAll()" value="提交" /></td>
</tr>
</table>
</div>
</body>
</html>