1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<script type="text/javascript">  
function save(){
var username = document.getElementById("username");
if(username.value ==""){
alert("用户名不能为空!");
return false;
}
var password = document.getElementById("password");
if(password.value ==""){
alert("密码不能为空!");
return false;
}
var repassword = document.getElementById("repassword");
if(repassword.value ==""){
alert("确认密码不能为空!");
return false;
}
if(password.value != repassword.value){
alert("两次输入密码不一致!");
return false;
}
var age = document.getElementById("age");
if(age.value ==""){
alert("年龄不能为空!");
return false;
}
if(isNaN(age.value)){
alert("年龄为数字!");
return false;
}
}
</script>