以下程序错在哪?

99_mei 2003-09-29 02:53:57
<%
user=trim(request.form("user"))
password=trim(Request.Form("password"))
if user="" then%>
<script language=vbscript>
MsgBox "错误:请输入用户帐号!"
location.href = "javascript:history.back()"
</script>
<%
end if
if password="" then%><script language=vbscript>
MsgBox "错误:请输入用户密码!"
location.href = "javascript:history.back()"
</script> <%
end if%>
<!-- #include file="conn.asp" -->
<% rs.Open "Select * From hd where user= '" &user&"'", conn, 3,3%>
<%if rs.bof then %> <script language=vbscript>
MsgBox "错误:此帐号不存在!"
location.href = "javascript:history.back()"
</script><%
elseif password<>rs("password") then%><script language=vbscript>
MsgBox "错误:您的密码不正确!"
location.href = "javascript:history.back()"
</script>
<%else if session("loginid")="true" then%>
<script language=vbscript>
MsgBox "正确!"
location.href = "javascript:history.back()"
</script>
<%
rs.close
set rs=nothing%>


Microsoft VBScript 编译器错误 错误 '800a03f6'

缺少 'End'

行33
...全文
29 18 打赏 收藏 转发到动态 举报
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
sunnyBelt 2003-09-30
  • 打赏
  • 举报
回复
<%else if session("loginid")="true" then%>
<script language=vbscript>
MsgBox "正确!"
location.href = "javascript:history.back()"
</script>
<%
rs.close
这里的"else if" 应该是"elseif"
而且应该在rs.close前面加上"End if"
zhanghao5188 2003-09-30
  • 打赏
  • 举报
回复
按提示:
Microsoft VBScript 编译器错误 错误 '800a03f6'

缺少 'End'

加上end if !!

<%
end if
rs.close
set rs=nothing%>


xxrl 2003-09-29
  • 打赏
  • 举报
回复
to qiao198(乔本) please read this sentence.
The indexOf method returns an integer value indicating the beginning of the substring within the String object. If the substring is not found, a -1 is returned.
//////////////////////////////////////////////////////////////////
About indexOf's use,you have a incorrect meaning,please read the MSDN carefully.
My God,the kind of player.
avonqin 2003-09-29
  • 打赏
  • 举报
回复
漏了几个end if,建议楼主把程序写得规范点,就不会出现这种错了
shauykee 2003-09-29
  • 打赏
  • 举报
回复
<% rs.Open "Select * From hd where user= '" &user&"'", conn, 3,3%>
<%if rs.bof then %> <script language=vbscript>
MsgBox "错误:此帐号不存在!"
location.href = "javascript:history.back()"
</script><%
else if password<>rs("password") then%><script language=vbscript>
MsgBox "错误:您的密码不正确!"
location.href = "javascript:history.back()"
</script>
<%else if session("loginid")="true" then%>
<script language=vbscript>
MsgBox "正确!"
location.href = "javascript:history.back()"
</script>
<%end if%>'************************************缺少
chinanetspy 2003-09-29
  • 打赏
  • 举报
回复
<%
user=trim(request.form("user"))
password=trim(Request.Form("password"))
if user="" then%>
<script language=vbscript>
MsgBox "错误:请输入用户帐号!"
location.href = "javascript:history.back()"
</script>
<%
end if
if password="" then%><script language=vbscript>
MsgBox "错误:请输入用户密码!"
location.href = "javascript:history.back()"
</script> <%
end if%>
<!-- #include file="conn.asp" -->
<% rs.Open "Select * From hd where user= '" &user&"'", conn, 3,3%>
<%if rs.bof then %> <script language=vbscript>
MsgBox "错误:此帐号不存在!"
location.href = "javascript:history.back()"
</script><%
else if password<>rs("password") then%><script language=vbscript>
MsgBox "错误:您的密码不正确!"
location.href = "javascript:history.back()"
</script>
<%else if session("loginid")="true" then%>
<script language=vbscript>
MsgBox "正确!"
location.href = "javascript:history.back()"
</script>
<%
rs.close
set rs=nothing%>
qiao198 2003-09-29
  • 打赏
  • 举报
回复
这样写太烦了,

<script language="JavaScript">
function clickform()
{
ff=document.reglog
if (ff.username.value=="") {
window.alert("用户名不能为空!")
ff.username.focus()
return false
}
if (ff.username.value.length>0 && (ff.username.value.indexOf("'")!=-1|| ff.username.value.indexOf("=")!=-1||ff.username.value.indexOf("%")!=-1||ff.username.value.indexOf("&")!=-1||ff.username.value.indexOf("?")!=-1||ff.username.value.indexOf("$")!=-1)){
window.alert("用户名中含有非法字符!")
ff.username.focus()
return false
}
if (ff.password.value=="") {
window.alert("密码不能为空!")
ff.password.focus()
return false
}
if (ff.password.value.length>0 && ff.password.value.indexOf("'")!=-1){
window.alert("用户口令中含有非法字符!")
ff.password.focus()
return false
}
}
</script>


<form name=reglog method="POST" action="login.asp" onsubmit="javascript:return clickform();">
<td width="750" colspan="3" >
 用户名:<input type="text" name="username" size="20" class="input1"> 密码:<input type="password" name="password" size="20" class="input1">
<input type="submit" value=" 登 录 " name="B1" class="input1">
<input type="reset" value=" 清 除 " name="B2" class="input1">
 </td>
</form>

后在login.asp进行ASP的判断

eafin 2003-09-29
  • 打赏
  • 举报
回复
<%user=trim(request.form("user"))
password=trim(Request.Form("password"))
if user="" then%>
<script language=vbscript>
MsgBox "错误:请输入用户帐号!"
location.href = "javascript:history.back()"
</script>
<%end if
if password="" then%>
<script language=vbscript>
MsgBox "错误:请输入用户密码!"
location.href = "javascript:history.back()"
</script>
<%end if%>
<!-- #include file="conn.asp" -->
<% rs.Open "Select * From hd where user= '" &user&"'", conn, 3,3%>
<%if rs.bof then %>
<script language=vbscript>
MsgBox "错误:此帐号不存在!"
location.href = "javascript:history.back()"
</script>
<%elseif password<>rs("password") then%>
<script language=vbscript>
MsgBox "错误:您的密码不正确!"
location.href = "javascript:history.back()"
</script>
<%elseif session("loginid")="true" then%>
<script language=vbscript>
MsgBox "正确!"
location.href = "javascript:history.back()"
</script>
<%end if
rs.close
set rs=nothing%>
007james 2003-09-29
  • 打赏
  • 举报
回复
<% end if
end if
rs.close
set rs=nothing%>
yangsm 2003-09-29
  • 打赏
  • 举报
回复
缺少两个end if if 另外还可以user=trim(request("user"))
lovehwq21 2003-09-29
  • 打赏
  • 举报
回复
没有End If语句,另外这句 <%else if session("loginid")="true" then%>
应该else跟if应该写合在一块,不然只能换行,写多个End If
chxzll 2003-09-29
  • 打赏
  • 举报
回复
在这些代码之后
<%if rs.bof then %> <script language=vbscript>
MsgBox "错误:此帐号不存在!"
location.href = "javascript:history.back()"
</script><%
elseif password<>rs("password") then%><script language=vbscript>
MsgBox "错误:您的密码不正确!"
location.href = "javascript:history.back()"
</script>
<%else if session("loginid")="true" then%>
<script language=vbscript>
MsgBox "正确!"
location.href = "javascript:history.back()"
</script>

<%
'在些应加上end if
rs.close
ygghost 2003-09-29
  • 打赏
  • 举报
回复
<%
end if
rs.close
set rs=nothing%>
homeyang 2003-09-29
  • 打赏
  • 举报
回复
<%if rs.bof then %> <script language=vbscript>
MsgBox "错误:此帐号不存在!"
location.href = "javascript:history.back()"
</script><%
elseif password<>rs("password") then%><script language=vbscript>
MsgBox "错误:您的密码不正确!"
location.href = "javascript:history.back()"
</script>
<% else
if session("loginid")="true" then%>
<script language=vbscript>
MsgBox "正确!"
location.href = "javascript:history.back()"
</script>
<% end if
end if
rs.close
set rs=nothing%>
xiaobird1 2003-09-29
  • 打赏
  • 举报
回复
加上end if

<%
end if
rs.close
set rs=nothing%>
chxzll 2003-09-29
  • 打赏
  • 举报
回复
在这些代码之后
<%if rs.bof then %> <script language=vbscript>
MsgBox "错误:此帐号不存在!"
location.href = "javascript:history.back()"
</script><%
elseif password<>rs("password") then%><script language=vbscript>
MsgBox "错误:您的密码不正确!"
location.href = "javascript:history.back()"
</script>
<%else if session("loginid")="true" then%>
<script language=vbscript>
MsgBox "正确!"
location.href = "javascript:history.back()"
</script>

<%
'在些应加上end if
rs.close
99_mei 2003-09-29
  • 打赏
  • 举报
回复
怎改?
chxzll 2003-09-29
  • 打赏
  • 举报
回复
没有end if 语句啊

28,390

社区成员

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

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