ASP表单提交的中止问题

来源:百度知道 编辑:UC知道 时间:2024/05/19 19:42:09
部分关键代码:
if len(userid)<5 then
flag=false
msgbox("用户名至少为5位数!")
..........
<input name="tijiao" type="submit" Value="提交" >

我现在是实现了用户名至少为5位数.的提示.但是表单继续提交到我指定的ASP页面.这么中止这个提交呢?是不是要在VBScript里加入中止提交的代码?请指教,或发样例到我的百度消息里.谢谢!
<script language="vbscript">
function tijiao_onclick()
dim myform
set myform=document.form1
userid=myform.uname.value
flag=true
if len(userid)<5 then
flag=false
msgbox("用户名至少为5位数!")
myform.uname.focus
return false
else
return true
end if
end function
</script>
提示错误:类型不匹配'ruturn'是怎么回事呢?

<form name="form1" method="post" action="somePage.asp" onSubmit="return CheckForm()">
<!--onSubmit属性指定处理函数即可-->
<!--这里是表单内容-->
</form>
如果你用的vbscript作为客户端验证脚本的话:
<script language="vbscript">
function CheckForm()
if len(userid)<5 then
msgbox("用户名至少为5位数!")
return false '此句将终止表单的提交
else
return true '此句允许表单立刻提交
end if
end function
</script>

类型不匹配'ruturn'-----
你可以能输出语句将这个'ruturn'的值,再你不数据库对应的接收字段比较是一下,看一下数据的类型如何.有可以你赋值的动作没有成功或其它的原因.