asp代码if语句错误提示缺少then
代码如下<%FunctionHeadNavigation()Dimrs,sql,urlnameurlname=Request.ServerVariables("SCRIP...
代码如下
<%
Function HeadNavigation()
Dim rs, sql,urlname
urlname=Request.ServerVariables("SCRIPT_NAME")
Set rs = server.CreateObject("adodb.recordset")
sql = "select * from Qianbo_Navigation where ViewFlag order by Sequence asc"
rs.Open sql, conn, 1, 1
If rs.bof And rs.EOF Then
response.Write "暂无导航"
Else
Do
If ISHTML = 1 Then
If urlname="""&rs("HtmlNavUrl")&""" Then
response.Write " <li class="selected"><a href="""&rs("HtmlNavUrl")&""" title="""&rs("NavName")&""">"&rs("NavName")&"</a></li>"
Else
response.Write " <li><a href="""&rs("HtmlNavUrl")&""" title="""&rs("NavName")&""">"&rs("NavName")&"</a></li>"
End if
If urlname="""&rs("NavUrl")&""" Then
response.Write " <li class="selected"><a href="""&rs("NavUrl")&""" title="""&rs("NavName")&""">"&rs("NavName")&"</a></li>"
Else
response.Write " <li><a href="""&rs("NavUrl")&""" title="""&rs("NavName")&""">"&rs("NavName")&"</a></li>"
End if
End If
rs.movenext
Loop Until rs.EOF
End If
rs.Close
Set rs = Nothing
End Function
%>
错误提示:
Microsoft VBScript 编译器错误 错误 '800a03f9'
缺少 'Then'
/Top.Asp,行 43
If urlname="""&rs("HtmlNavUrl")&""" Then
-------------------^ 展开
<%
Function HeadNavigation()
Dim rs, sql,urlname
urlname=Request.ServerVariables("SCRIPT_NAME")
Set rs = server.CreateObject("adodb.recordset")
sql = "select * from Qianbo_Navigation where ViewFlag order by Sequence asc"
rs.Open sql, conn, 1, 1
If rs.bof And rs.EOF Then
response.Write "暂无导航"
Else
Do
If ISHTML = 1 Then
If urlname="""&rs("HtmlNavUrl")&""" Then
response.Write " <li class="selected"><a href="""&rs("HtmlNavUrl")&""" title="""&rs("NavName")&""">"&rs("NavName")&"</a></li>"
Else
response.Write " <li><a href="""&rs("HtmlNavUrl")&""" title="""&rs("NavName")&""">"&rs("NavName")&"</a></li>"
End if
If urlname="""&rs("NavUrl")&""" Then
response.Write " <li class="selected"><a href="""&rs("NavUrl")&""" title="""&rs("NavName")&""">"&rs("NavName")&"</a></li>"
Else
response.Write " <li><a href="""&rs("NavUrl")&""" title="""&rs("NavName")&""">"&rs("NavName")&"</a></li>"
End if
End If
rs.movenext
Loop Until rs.EOF
End If
rs.Close
Set rs = Nothing
End Function
%>
错误提示:
Microsoft VBScript 编译器错误 错误 '800a03f9'
缺少 'Then'
/Top.Asp,行 43
If urlname="""&rs("HtmlNavUrl")&""" Then
-------------------^ 展开
2个回答
展开全部
正确代码如下:
Function HeadNavigation()
Dim rs, sql,urlname
urlname=Request.ServerVariables("SCRIPT_NAME")
Set rs = server.CreateObject("adodb.recordset")
sql = "select * from Qianbo_Navigation where ViewFlag order by Sequence asc"
rs.Open sql, conn, 1, 1
If rs.bof And rs.EOF Then
response.Write "暂无导航"
Else
Do
If ISHTML = 1 Then
If urlname=rs("HtmlNavUrl") Then
response.Write " <li class=""selected""><a href="""&rs("HtmlNavUrl")&""" title="""&rs("NavName")&""">"&rs("NavName")&"</a></li>"
Else
response.Write " <li><a href="""&rs("HtmlNavUrl")&""" title="""&rs("NavName")&""">"&rs("NavName")&"</a></li>"
End if
If urlname=rs("NavUrl") Then
response.Write " <li class=""selected""><a href="""&rs("NavUrl")&""" title="""&rs("NavName")&""">"&rs("NavName")&"</a></li>"
Else
response.Write " <li><a href="""&rs("NavUrl")&""" title="""&rs("NavName")&""">"&rs("NavName")&"</a></li>"
End if
End If
rs.movenext
Loop Until rs.EOF
End If
rs.Close
Set rs = Nothing
End Function
Function HeadNavigation()
Dim rs, sql,urlname
urlname=Request.ServerVariables("SCRIPT_NAME")
Set rs = server.CreateObject("adodb.recordset")
sql = "select * from Qianbo_Navigation where ViewFlag order by Sequence asc"
rs.Open sql, conn, 1, 1
If rs.bof And rs.EOF Then
response.Write "暂无导航"
Else
Do
If ISHTML = 1 Then
If urlname=rs("HtmlNavUrl") Then
response.Write " <li class=""selected""><a href="""&rs("HtmlNavUrl")&""" title="""&rs("NavName")&""">"&rs("NavName")&"</a></li>"
Else
response.Write " <li><a href="""&rs("HtmlNavUrl")&""" title="""&rs("NavName")&""">"&rs("NavName")&"</a></li>"
End if
If urlname=rs("NavUrl") Then
response.Write " <li class=""selected""><a href="""&rs("NavUrl")&""" title="""&rs("NavName")&""">"&rs("NavName")&"</a></li>"
Else
response.Write " <li><a href="""&rs("NavUrl")&""" title="""&rs("NavName")&""">"&rs("NavName")&"</a></li>"
End if
End If
rs.movenext
Loop Until rs.EOF
End If
rs.Close
Set rs = Nothing
End Function
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
="""&rs("HtmlNavUrl")&""" 为什么要这么写呢?&""" 没有任何意义啊!!
If urlname=rs("HtmlNavUrl") Then
If urlname=rs("HtmlNavUrl") Then
更多追问追答
追问
修改之后``
Microsoft VBScript 编译器错误 错误 '800a03ea'
语法错误
/Top.Asp,行 43
If urlname=&rs("HtmlNavUrl")& Then
-----------^
追答
你没按我说的写,为什么还要加&
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询