ASP导航问题。会的进………………

来源:百度知道 编辑:UC知道 时间:2024/05/25 08:18:26
ASP导航,可读数据库的,

例:

菜单|菜单|菜单|菜单

菜单与菜单之间有个“|”1个菜单就不显视出来。

这样的ASP代码,谢谢………………
……
<ul>
<%
if rs.recordcount>1 then
count=rs.recordcount
for 1 to count-1
%>
<li><%=rs("菜单字段")%></li>
<li>|</li>
<%
rs.movenext
next
%>
<li><%=rs("菜单字段")%></li>
</ul>
<%
else
%>
<li><%=rs("菜单字段")%></li>
<%
end if
rs.close

运行不了, ``能不能给个给个完整的代码出来

数据库名:dtaa.mdb 表名:name

还:导航是有键接的,`

加上链接的代码,其中的链接地址你也可从数据中调用,写成
menustr=menustr+"<a href="+rs("linkstr")+" target=blank>"+rs("菜单字段")+"</a>|"
注意:如果你的链接是这样的www.xx.com完整的url地址则应该写成
http://加上你的链接的网站,当然了如果地址中含有http://就不用家了,总之站外链接地址中应该有http://字符,不知道说的是不是明白
一下是变更后的代码
------

<%
if not rs.eof then
while not rs.eof
menustr=menustr+"<a href=链接地址 target=blank>"+rs("菜单字段")+"</a>|"
rs.movenext
wend
menustrlen=len(menustr)
menustr=left(menustr,menustrlen-1)
response.write menustr
else
response.write "暂时没有菜单项目"
end if
%>
试试吧应该没有问题的,我一般都这样写的

另:rs.recordcount很不好用的,需要你的cursorlocation 和cursortype两个参数设置正确,否则往往会得到-1

数据库字段 biao
sql=select ....
..

if rs.recordcount<=1 then
response.write rs("biao"