<%@ page language=
"java"
contentType=
"text/html; charset=utf-8"
pageEncoding=
"utf-8"
%>
<script language=
"JavaScript"
>
function isValidate(form)
{
// 得到用户输入的信息
mian = form.mianji.value;
fangjian = form.fangjianshu.value;
idnumbe= form.idnumber.value;
if
(!isNumber(mian)) {
alert(
"面积数需要为整数"
);
form.mianji.focus();
return
false
;
}
if
(!isNumber(fangjian)) {
alert(
"房间数需要为整数"
);
form.fangjianshu.focus();
return
false
;
}
if
(!Length(idnumbe,
18
)) {
alert(
"请正确输入身份证号"
);
form.idnumber.focus();
return
false
;
}
return
true
;
}
// 判断是否是整数
function isNumber(str)
{
for
(i=
0
;i<str.length;i++)
{
// 每一位都是 0~9 的数字,如果是第 1 位,则可以是“-”号
if
(str.charAt(i)>=
'0'
&& str.charAt(i)<=
'9'
|| str.charAt(i)==
'-'
&& i==
0
){
continue
;
}
else
{
return
false
;
}
}
return
true
;
}
function Length(str,length)
{
if
(str.length==length){
return
true
;
}
else
{
return
false
;
}
}
</script>
<html>
<head>
<title>信息登记</title>
</head>
<body>
<h2 align=
"center"
>请注册</h2>
<form name=
"form1"
action=
"Adengjiqueren.jsp"
method=
"post"
onsubmit=
"return isValidate(form1)"
>
<table align=
"center"
>
<tr>
<td>住房类型:</td>
<td>
<input type=
"radio"
name=
"hubie"
value=
"家庭户"
>家庭户
<input type=
"radio"
name=
"hubi"
value=
"集体户"
>集体户
</td>
</tr>
<tr>
<td>住房类型:</td>
<td>
<input type=
"radio"
name=
"hometype"
value=
"家庭住宅"
>家庭住宅
<input type=
"radio"
name=
"hometype"
value=
"集体住所"
>集体住所
<input type=
"radio"
name=
"hometype"
value=
"工作地住所"
>工作地住所
<input type=
"radio"
name=
"hometype"
value=
"其他住宅"
>其他住宅
<input type=
"radio"
name=
"hometype"
value=
"无住宅"
>无住宅
</td>
</tr>
<tr>
<td>本户现住房面积:</td>
<td><input type=
"text"
name=
"mianji"
>只能输入整数</td>
</tr>
<tr>
<td>本户现住房间数:</td>
<td><input type=
"text"
name=
"fangjianshu"
>只能输入整数</td>
</tr>
<tr>
<td>户主姓名:</td>
<td><input type=
"text"
name=
"hname"
></td>
</tr>
<tr>
<td>身份证号码:</td>
<td><input type=
"text"
name=
"idnumber"
>请输入
18
位身份证号码</td>
</tr>
<tr>
<td>性别:</td>
<td>
<input type=
"radio"
name=
"xingbie"
value=
"男"
>男
<input type=
"radio"
name=
"xingbie"
value=
"女"
>女
</td>
</tr>
<tr>
<td>民族:</td>
<td><input type=
"text"
name=
"minzu"
></td>
</tr>
<tr>
<td>受教育程度:</td>
<td>
<select name=
"degree"
>
<option value=
"研究生"
>研究生:</option>
<option value=
"大学本科"
>大学本科:</option>
<option value=
"大学专科"
>大学专科:</option>
<option value=
"高中"
>高中:</option>
<option value=
"小学"
>小学:</option>
<option value=
"未上过学"
>未上过学:</option>
</select>
</td>
</tr>
<tr>
<td><input type=
"reset"
value=
"重置"
></td>
<td><input type=
"submit"
value=
"提交"
></td>
</tr>
<table>
</form>
</body>
</html>