一个错误!请高手指点!再线等待!高分相送!

xm_44 2002-08-21 02:59:09
我的程序如下:
<%@ Language=VBScript %>
<!--#include file="../inc/doracle.asp"-->
<html>
<head>
<title>综合查询</title>
<link rel="stylesheet" type="text/css" href="../inc/style.css">
<script language="JavaScript">
function verfy()
{
if (document.form.id.value == "") && (document.form.name.value == "") && (document.form.address.value == "")
{
alert("请您至少填写身份证号、姓名、暂住地址中的一项!");
document.form.id.focus();
return (false);
}
if (document.form.checkbox1.value! == "")
{
if ((document.form.id.value == "") || (document.form.id.value.length !=18 && document.form.id.value.length !=10))
{
alert("请您填写正确的身份证号!");
document.form.id.focus();
return (false);
}
}
if (document.form.checkbox4.value! == "")
{
if ((document.form .csnf .value == "" )||(document.form .csnf .value <= 1900 && document.form.csnf.value != ""))
{
alert("请填写正确年份");
document.form.csnf.focus();
return (false);
}
if (isNaN(document.form .csyf .value )||(document.form.csyf.value != "" && document.form.csyf.value < 1 || document.form.csyf.value > 12))
{
alert("请填写正确的月份");
document.form.csyf.focus();
return (false);
}
if (isNaN(document.form .csri .value )||(document.form.csri.value != "" && document.form.csri.value < 1 || document.form.csri.value > 31))
{
alert("请填写正确的日期");
document.form.csri.focus();
return (false);
}
if (!((document.form.csri .value =="" && document.form.csyf.value =="" && document.form .csnf .value =="")||(document.form.csri .value!="" && document.form.csyf.value!="" && document.form .csnf .value !="")))
{
alert("请填写完整有效时间");
document.form.csnf.focus ();
return (false);
}
}
}
</script>
</head>

<body>
<p>  </p>
<form name="form" action="zhshow.asp" method="post" onsubmit="return verfy()">
<table width="97%" border="0" align="center">
<tr>
<td colspan="3">请在您所知的查询条件左边打勾,并在右边添入相应信息!</td>
</tr>
<tr>
<td width="19%"> </td>
<td colspan="2">*注意:需输入身份证号、姓 名、住 址中至少一个</td>
</tr>
<tr>
<td><input type="checkbox" name="checkbox1" value="id_no">
身份证号:</td>
<td colspan="2"><input name="id" type="text" id="id"></td>
</tr>
<tr>
<td><input type="checkbox" name="checkbox2" value="name">
姓 名 :</td>
<td colspan="2"><input name="name" type="text" id="name3"></td>
</tr>
<tr>
<td height="20"><input type="checkbox" name="checkbox3" value="sex_no">
性 别 :</td>
<td colspan="2"> <select name="sex">
<option value="男">男</option>
<option value="女">女</option>
</select> </td>
</tr>
<tr>
<td><input type="checkbox" name="checkbox4" value="birthday">
出生日期:</td>
<td colspan="2">
<input name="csnf" type="text" id="csnf" size="4" maxlength="4">

<input name="csyf" type="text" id="csyf" size="2" maxlength="2">

<input name="csri" type="text" id="csri" size="2" maxlength="2">
日</td>
</tr>
<tr>
<td><input type="checkbox" name="checkbox5" value="address3">
住 址 :</td>
<td colspan="2"><input name="address" type="text" id="address3"></td>
</tr>
<tr>
<td><div align="center">
<input type="submit" name="Submit" value="查询">
</div></td>
<td width="33%"><div align="center">
<input type="reset" name="Submit2" value="重填">
</div></td>
<td width="48%"> <div align="left">
<input type="button" name="Submit3" value="返回" onclick="javascript:window.history.go(-1)">
</div></td>
</tr>
</table>
</form>
</body>
</html>

可是老是运行到半路弹出提示错误窗口如下:
An exception of type'Microsoft Jscript 运行时错误:缺少对象' was not handled。
请问是什么原因!不甚感激!




...全文
20 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
meetweb 2002-08-22
  • 打赏
  • 举报
回复
你只能设置一个选择的按钮,要不选择按照身份证号查询,要不按照日期查询,这样你在js里检查checkbox的值,什么时候要检查日期,不就德啦
xm_44 2002-08-22
  • 打赏
  • 举报
回复
我是想既能综合查询又能单项查询!
xm_44 2002-08-21
  • 打赏
  • 举报
回复
大家好:
我已经把这个错误解决了,谢谢大家的提醒,现在的问题是:我本意是只要输入身份证号就可以查询的,可是现在我输入身份证号,点击查询可是却弹出了提示“请填写正确年份”的窗口,请问这个逻辑问题该如何改程序?谢谢!
MeXP 2002-08-21
  • 打赏
  • 举报
回复
在我刚给你修改的代码上,将<form name=form给为其它名字,<form name=form1>,当然javascript中的也需要改
meetweb 2002-08-21
  • 打赏
  • 举报
回复
或者你先去掉一不部分的js先测试,
我的意思是先测试
注意:需输入身份证号、姓 名、住 址中至少一个检验
然后再检验正确的身份证号
后请填写正确年份 这样你就可以找到错误的地方
MeXP 2002-08-21
  • 打赏
  • 举报
回复
错误太多了,先修改了一部分,你试试
<!--#include file="../inc/doracle.asp"-->
<html>
<head>
<title>综合查询</title>
<link rel="stylesheet" type="text/css" href="../inc/style.css">
<script language="JavaScript">
function verfy()
{
if (document.form.id.value == "") && (document.form.name.value == "") && (document.form.address.value == "")
{
alert("请您至少填写身份证号、姓名、暂住地址中的一项!");
document.form.id.focus();
return false;
}
else if (document.form.checkbox1.value!= "")
{
if ((document.form.id.value == "") || (document.form.id.value.length !=18 && document.form.id.value.length !=10))
{
alert("请您填写正确的身份证号!");
document.form.id.focus();
return false;
}
}
else if (document.form.checkbox4.value!= "")
{
if ((document.form.csnf.value == "" )||(document.form.csnf.value <= 1900 && document.form.csnf.value != ""))
{
alert("请填写正确年份");
document.form.csnf.focus();
return false;
}
if (isNaN(document.form.csyf.value )||(document.form.csyf.value != "" && document.form.csyf.value < 1 || document.form.csyf.value > 12))
{
alert("请填写正确的月份");
document.form.csyf.focus();
return false;
}
if (isNaN(document.form.csri.value )||(document.form.csri.value != "" && document.form.csri.value < 1 || document.form.csri.value > 31))
{
alert("请填写正确的日期");
document.form.csri.focus();
return false;
}
if (!((document.form.csri.value =="" && document.form.csyf.value =="" && document.form.csnf.value =="")||(document.form.csri.value!="" && document.form.csyf.value!="" && document.form.csnf.value !="")))
{
alert("请填写完整有效时间");
document.form.csnf.focus();
return false;
}
}
else
return true;
}
</script>
</head>

<body>
<p>  </p>
<form name="form" action="" method="post" onsubmit="javascrpt:return verfy();">
<table width="97%" border="0" align="center">
<tr>
<td colspan="3">请在您所知的查询条件左边打勾,并在右边添入相应信息!</td>
</tr>
<tr>
<td width="19%"> </td>
<td colspan="2">*注意:需输入身份证号、姓 名、住 址中至少一个</td>
</tr>
<tr>
<td><input type="checkbox" name="checkbox1" value="id_no">
身份证号:</td>
<td colspan="2"><input name="id" type="text" id="id"></td>
</tr>
<tr>
<td><input type="checkbox" name="checkbox2" value="name">
姓 名 :</td>
<td colspan="2"><input name="name" type="text" id="name3"></td>
</tr>
<tr>
<td height="20"><input type="checkbox" name="checkbox3" value="sex_no">
性 别 :</td>
<td colspan="2"> <select name="sex">
<option value="男">男</option>
<option value="女">女</option>
</select> </td>
</tr>
<tr>
<td><input type="checkbox" name="checkbox4" value="birthday">
出生日期:</td>
<td colspan="2">
<input name="csnf" type="text" id="csnf" size="4" maxlength="4">

<input name="csyf" type="text" id="csyf" size="2" maxlength="2">

<input name="csri" type="text" id="csri" size="2" maxlength="2">
日</td>
</tr>
<tr>
<td><input type="checkbox" name="checkbox5" value="address3">
住 址 :</td>
<td colspan="2"><input name="address" type="text" id="address3"></td>
</tr>
<tr>
<td><div align="center">
<input type="submit" name="Submit" value="查询">
</div></td>
<td width="33%"><div align="center">
<input type="reset" name="Submit2" value="重填">
</div></td>
<td width="48%"> <div align="left">
<input type="button" name="Submit3" value="返回" onclick="javascript:window.history.go(-1)">
</div></td>
</tr>
</table>
</form>
</body>
</html>
hu1dao 2002-08-21
  • 打赏
  • 举报
回复
错误1:你的if语句错了
原if (document.form.id.value == "") && (document.form.name.value == "") && (document.form.address.value == "")
改为:if ((document.form.id.value == "") && (document.form.name.value == "") && (document.form.address.value == ""))
错误2:你的“不等于”错了
原: !==
改为: !=
错误3:....没有看下去了

meetweb 2002-08-21
  • 打赏
  • 举报
回复
错误在于js,请把具体的js错误代码给我,知道是那一行错了吗

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧