ASP,帮帮我,解决一下,有函数,就不会调转到其他页面了啊!帮我解决一下!谢谢

来源:百度知道 编辑:UC知道 时间:2024/05/18 11:08:09
<script language="vbscript" >
sub check()
if form1.name1.value=empty then
msgbox "请填入您的真实姓名!"
focusto(0)
exit sub
end if
if form1.userid.value="" then
msgbox "请填写您的帐号号码!"
focusto(1)
exit sub
end if
if form1.password1.value="" then
msgbox "请设置您的登录密码!"
focusto(2)
exit sub
end if
if form1.password2.value="" then
msgbox "请输入您输入的密码!"
focusto(3)
exit sub
end if
if form1.password2.value<>form1.password1.value then
msgbox "您的密码设置有误!"
focusto(3)
exit sub
end if
if form1.email.value="" then
msgbox "请输入您输入的邮箱地址!"
focusto(10)
exit sub
end if

因为你根本没有name1这个元素,所以执行
if form1.name1.value=empty then
肯定出错,提示找不到name1元素

解决方法是添加所需要的元素,或者把没用的代码去掉,如

<script language="vbscript" >
sub check()
/*if form1.answer.value="" then
msgbox "请设置您的问题的回答!"
focusto(5)
exit sub
end if*/
form1.subimt
end sub
sub focusto(x)
document.form1.elements(x).focus()
end sub
</script>