出现运行期错误,缺少对象,行120,是怎么回事?怎么解决?

small 2002-03-06 02:41:37
我的网页中有javascript.
...全文
147 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
海盗2019 2002-03-07
  • 打赏
  • 举报
回复
if ((document.hyzc.yhm.value!="") && (document.hyzc.email.value!="")
lvxing 2002-03-06
  • 打赏
  • 举报
回复
分特

=== 和 !== 是 PHP 里的嚴格判斷, JS 里沒有的
zxyufan 2002-03-06
  • 打赏
  • 举报
回复
!==

分特~~~老大~~~应该是 !=
David017 2002-03-06
  • 打赏
  • 举报
回复
实际上,你出错的这句,是重复的,上面已经判断过了。
可以直接return true;

if (document.hyzc.yhm.value!=="")and (document.hyzc.email.value!=="")
{
return true;
}
David017 2002-03-06
  • 打赏
  • 举报
回复
!== 多写一个 = 或者是多写了一个!
and 不是javascript关键字,用&&
if后面的用()括起来。
David017 2002-03-06
  • 打赏
  • 举报
回复
120/118行:
if (document.hyzc.yhm.value!=="")and (document.hyzc.email.value!=="")
修改为:

if ((document.hyzc.yhm.value!="") && (document.hyzc.email.value!=""))
small 2002-03-06
  • 打赏
  • 举报
回复
<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>基本信息</title>
</head>

<body>

<form method="POST" action="hy.php" onsubmit="return checkform();" name="hyzc">
<div align="center">
<center>
<table width="90%" border="1" cellspacing="0" align="center" bordercolor="#66CCFF">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%" bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="218" bgcolor="#FFFFFF" bordercolor="#FF0000">
<tr>
<td width="100%" colspan="2" height="41" bgcolor="#66CCFF">
<p align="center"><font size="2"><b><font color="#0000FF">基本信息</font></b></font>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2" height="23" align="right"> </td>
</tr>
<tr>
<td width="30%" height="23" align="right" bgcolor="#D1EAFC"><font size="2" color="#FF0000">*</font><font size="2">用户名:</font></td>
<td width="70%" height="23" bgcolor="#FFFFFF"><font size="2">
<input type="text" name="yhm" size="20">
(最大长度为12位有效字符,必须填写)</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="100%" height="23" align="right" colspan="2"> </td>
</tr>
<tr>
<td width="30%" height="23" align="right" bgcolor="#D1EAFC"><font size="2">职务:</font></td>
<td width="70%" height="23" bgcolor="#FFFFFF"><font size="2">
<input type="text" name="zw" size="52">
</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="100%" height="23" align="right" colspan="2"> </td>
</tr>
<tr>
<td width="30%" height="23" align="right" bgcolor="#D1EAFC"><font size="2">工作单位:</font></td>
<td width="70%" height="23" bgcolor="#FFFFFF" bordercolor="#993300"><font size="2">
<input type="text" name="dw" size="52">
</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="100%" height="23" align="right" colspan="2"> </td>
</tr>
<tr>
<td width="30%" height="23" align="right" bgcolor="#D1EAFC"><font size="2">单位电话:</font></td>
<td width="70%" height="23" bgcolor="#FFFFFF"><font size="2">
<input type="text" name="tel" size="20">
</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="100%" height="23" align="right" colspan="2"> </td>
</tr>
<tr>
<td width="30%" height="23" align="right" bgcolor="#D1EAFC"><font size="2">收信(支票)的地址与姓名:</font></td>
<td width="70%" height="23" bgcolor="#FFFFFF">
<textarea rows="2" name="ad_na" cols="37"></textarea>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="100%" height="23" align="right" colspan="2"> </td>
</tr>
<tr>
<td width="30%" height="23" align="right" bgcolor="#D1EAFC"><font size="2" color="#FF0000">*</font><font size="2">电子信箱:</font></td>
<td width="70%" height="23" bgcolor="#FFFFFF"><font size="2">
<input type="text" name="email" size="39">
(必须填写)</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="100%" height="23" align="right" colspan="2"> </td>
</tr>
<tr>
<td width="30%" height="23" align="right" bgcolor="#D1EAFC"><font size="2">其它联系方法:</font></td>
<td width="70%" height="23" bgcolor="#FFFFFF"><font size="2">
<input type="text" name="method" size="39">
</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="100%" height="23" align="right" colspan="2"> </td>
</tr>
</table>
<div align="center"></div>
</td>
</tr>
</table>
</center>
</div>
<p> </p>
<p align="center"><input type="submit" value="提交" name="B1">       
<input type="reset" value="全部重写" name="B2"></p>
</form>
</body>
<script language="javascript">
function checkform()
{
if (document.hyzc.yhm.value=="")
{
alert("请输入用户名!");
return false;
}

if (document.hyzc.email.value=="")
{
alert("请输入电子信箱!");
return false;
}

if (document.hyzc.yhm.value!=="")and (document.hyzc.email.value!=="")
{
return true;
}
}
</script>
</html>

这是源码。
small 2002-03-06
  • 打赏
  • 举报
回复
<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>基本信息</title>
</head>

<body>

<form method="POST" action="hy.php" onsubmit="return checkform();" name="hyzc">
<div align="center">
<center>
<table width="90%" border="1" cellspacing="0" align="center" bordercolor="#66CCFF">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%" bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="218" bgcolor="#FFFFFF" bordercolor="#FF0000">
<tr>
<td width="100%" colspan="2" height="41" bgcolor="#66CCFF">
<p align="center"><font size="2"><b><font color="#0000FF">基本信息</font></b></font>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2" height="23" align="right"> </td>
</tr>
<tr>
<td width="30%" height="23" align="right" bgcolor="#D1EAFC"><font size="2" color="#FF0000">*</font><font size="2">用户名:</font></td>
<td width="70%" height="23" bgcolor="#FFFFFF"><font size="2">
<input type="text" name="yhm" size="20">
(最大长度为12位有效字符,必须填写)</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="100%" height="23" align="right" colspan="2"> </td>
</tr>
<tr>
<td width="30%" height="23" align="right" bgcolor="#D1EAFC"><font size="2">职务:</font></td>
<td width="70%" height="23" bgcolor="#FFFFFF"><font size="2">
<input type="text" name="zw" size="52">
</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="100%" height="23" align="right" colspan="2"> </td>
</tr>
<tr>
<td width="30%" height="23" align="right" bgcolor="#D1EAFC"><font size="2">工作单位:</font></td>
<td width="70%" height="23" bgcolor="#FFFFFF" bordercolor="#993300"><font size="2">
<input type="text" name="dw" size="52">
</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="100%" height="23" align="right" colspan="2"> </td>
</tr>
<tr>
<td width="30%" height="23" align="right" bgcolor="#D1EAFC"><font size="2">单位电话:</font></td>
<td width="70%" height="23" bgcolor="#FFFFFF"><font size="2">
<input type="text" name="tel" size="20">
</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="100%" height="23" align="right" colspan="2"> </td>
</tr>
<tr>
<td width="30%" height="23" align="right" bgcolor="#D1EAFC"><font size="2">收信(支票)的地址与姓名:</font></td>
<td width="70%" height="23" bgcolor="#FFFFFF">
<textarea rows="2" name="ad_na" cols="37"></textarea>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="100%" height="23" align="right" colspan="2"> </td>
</tr>
<tr>
<td width="30%" height="23" align="right" bgcolor="#D1EAFC"><font size="2" color="#FF0000">*</font><font size="2">电子信箱:</font></td>
<td width="70%" height="23" bgcolor="#FFFFFF"><font size="2">
<input type="text" name="email" size="39">
(必须填写)</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="100%" height="23" align="right" colspan="2"> </td>
</tr>
<tr>
<td width="30%" height="23" align="right" bgcolor="#D1EAFC"><font size="2">其它联系方法:</font></td>
<td width="70%" height="23" bgcolor="#FFFFFF"><font size="2">
<input type="text" name="method" size="39">
</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="100%" height="23" align="right" colspan="2"> </td>
</tr>
</table>
<div align="center"></div>
</td>
</tr>
</table>
</center>
</div>
<p> </p>
<p align="center"><input type="submit" value="提交" name="B1">       
<input type="reset" value="全部重写" name="B2"></p>
</form>
</body>
<script language="javascript">
function checkform()
{
if (document.hyzc.yhm.value=="")
{
alert("请输入用户名!");
return false;
}

if (document.hyzc.email.value=="")
{
alert("请输入电子信箱!");
return false;
}

if (document.hyzc.yhm.value!=="")and (document.hyzc.email.value!=="")
{
return true;
}
}
</script>
</html>
darzui 2002-03-06
  • 打赏
  • 举报
回复
那应该是javascript的问题
rosen 2002-03-06
  • 打赏
  • 举报
回复
代码贴出来

21,891

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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