主题:  关于表单验证的简单问题

看我的资料

职务:普通成员
等级:1
金币:0.0
发贴:81
注册:2003/5/24 12:06:05
#12004/2/24 19:30:45
为什么提示:对象不匹配 'return checkform()'
源代码如下:
<script language="VBScript" type="text/VBScript">
sub checkform()
set theform=document.i
varubmit=false
if i.varyear.value="" or not isNumeric(i.varyear.value)then
myerryear="您没有填写案件的年度!或者填入了非法字符!"
end if
if i.varcode.value="" or not isNumeric(i.varcode.value)then
myerrcode="您没有输入案号!或者输入了非法字符!"
end if
if myerryear="" and myerrcode="" then
varubmit=true
end if
if varubmit=true then
theform.submit
else
msgbox("错误提示:"&chr(13)&myerryear&chr(13)&myerrcode)
end if
end sub
</script>
<form name="i" action="aj_sxadd2.asp" onsubmit="return checkform()">
……
</form>
<input name="" type="image" src="images/good.gif" border="0">



=ridincal=

职务:管理员
等级:7
金币:20.0
发贴:5886
注册:2004/1/13 11:47:04
#22004/2/25 10:03:59
<form name="i" action="aj_sxadd2.asp" onsubmit="checkform()">



看我的资料

职务:普通成员
等级:1
金币:0.0
发贴:81
注册:2003/5/24 12:06:05
#32004/2/25 17:21:34
现在是验证不起作用,显示msgbox内容以后,仍然跳转到了aj_sxadd2.asp网页



chaojijing

职务:普通成员
等级:1
金币:0.0
发贴:62
注册:2002/1/23 22:53:02
#42004/3/1 16:42:51
用插件吧,checkform,功能很强大



缺缺

职务:管理员
等级:8
金币:41.0
发贴:9620
注册:2004/1/14 19:14:47
#52004/3/1 16:58:39
你定义的函数没有返回任何值,没有阻止表单提交,return有什么用?