28,391
社区成员
发帖
与我相关
我的任务
分享
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html>
<head>
<script language="vbscript">
Function IDCheck(e)
IDCheck = true
e=document.getElementById("shenfenzheng1").value
If Len(e) <> 18 Then
IDCheck= "身份证号码输入错误!"
msgbox IDCheck
IDCheck = False
Exit Function
End If
if IDCheck <> false then
IDCheck= "恭喜你的身份证检测通过。"
msgbox IDCheck
IDCheck = true
Exit Function
End if
End Function
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>
</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<input name="shenfenzheng1" type="text" id="shenfenzheng1">
<input type="submit" name="Submit" value="检测" onClick="IDCheck(e)">
</form>
<%
dim a1,a2
a1=request.Form("shenfenzheng1")
a2=msgbox "IDCheck" '这里不会写,获取不了IDCheck值。
if a1 <> "" and a2 = "恭喜你的身份证检测通过。" then '这里不会写,获取不了IDCheck值。
if len(a1) = 15 then
response.Write("aaaaaaaaaaaaaaaaaaa")
else
response.Write("bbbbbbbbbbbbbbbbbbb")
end if
else
end if
%>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>身份证验证</title>
</head>
<body>
<script type="text/javascript">
function isIdCard(arrIdCard){
var tag = false;
var sigma = 0;
var a = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 );
var w = new Array("1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2");
for (var i = 0; i < 17; i++) {
var ai = parseInt(arrIdCard.substring(i, i + 1));
var wi = a[i];
sigma += ai * wi;
}
var number = sigma % 11;
var check_number = w[number];
if (arrIdCard.substring(17) != check_number) {
tag = false;
} else {
tag = true;
}
return tag;
}
function IDCheck(){
var i=document.getElementById("shenfenzheng1").value;
if(!isIdCard(i)){
alert("身份证错误!");
return false;
}
}
</script>
<form id="form1" name="form1" method="post" action="">
<input name="shenfenzheng1" type="text" id="shenfenzheng1" maxlength="18" onkeyup="this.value=this.value.replace(/[^\dx]/,'')">
<input type="submit" name="Submit" value="检测" onClick="return IDCheck()">
</form>
<%
dim id
id=request.form("shenfenzheng1")
if len(id)=18 then
Response.write "身份证"&id&"检测通过"
end if
%>
</body>
</html>