asp中数据库中的菜单自动换行的问题
这是个导航上的menu.asp菜单想实现---显示十个菜单后自动换行但却实现不了那位高手帮忙看看是那里出问题了呢?<%dimRecordCount,total,menun...
这是个导航上的menu.asp菜单
想实现---显示十个菜单后自动换行
但却实现不了
那位高手帮忙看看是那里出问题了呢?
<%
dim RecordCount,total,menunumber
set rs=server.CreateObject("ADODB.RecordSet")
rs.Source="select * from type where typeview=1 order by typeorder"
rs.Open rs.Source,conn,1,1
i=1
total=1'???
menunumber=10'???????????
while not rs.EOF
RecordCount=rs.RecordCount
menuid=rs("typeid")
menuname=rs("typename")
menucontent=rs("typecontent")
menuview=rs("typeview")
if total=menunumber then
%>
mpmenu<%=menuid%>=new mMenu('<span height:9px;">| <%=menuName%> </span><br>','more.asp?typeID=<%=menuid%>','self','','','','');
<%
total=1
else%>
mpmenu<%=menuid%>=new mMenu('<span height:9px;">| <%=menuName%> </span>','more.asp?typeID=<%=menuid%>','self','','','','');
<%
total=total+1
end if
set rs1=server.CreateObject("ADODB.RecordSet")
set rs1=conn.execute("SELECT * FROM border where typeid="&menuid&" and borderview=1 order by borderorder")
if not rs1.EOF then
do while not rs1.eof
%>
<%if not Rs1.eof then%>
mpmenu<%=menuid%>.addItem(new mMenuItem(' <span style="line-height: 20px;"><%=Rs1("bordername")%>','more.asp?typeid=<%=menuid%>&borderid=<%=Rs1("borderid")%>','self',false,'<%=Rs1("bordername")%>','','','',''));
<%
end if
rs1.movenext
loop
end if
rs1.close
%>
<%
i=i+1
rs.MoveNext
wend
rs.close
set rs=nothing
%>
导航上的菜单是调用数据库中的字段自动生成的
现在想实现这些菜单在>10个后的自动换行功能 展开
想实现---显示十个菜单后自动换行
但却实现不了
那位高手帮忙看看是那里出问题了呢?
<%
dim RecordCount,total,menunumber
set rs=server.CreateObject("ADODB.RecordSet")
rs.Source="select * from type where typeview=1 order by typeorder"
rs.Open rs.Source,conn,1,1
i=1
total=1'???
menunumber=10'???????????
while not rs.EOF
RecordCount=rs.RecordCount
menuid=rs("typeid")
menuname=rs("typename")
menucontent=rs("typecontent")
menuview=rs("typeview")
if total=menunumber then
%>
mpmenu<%=menuid%>=new mMenu('<span height:9px;">| <%=menuName%> </span><br>','more.asp?typeID=<%=menuid%>','self','','','','');
<%
total=1
else%>
mpmenu<%=menuid%>=new mMenu('<span height:9px;">| <%=menuName%> </span>','more.asp?typeID=<%=menuid%>','self','','','','');
<%
total=total+1
end if
set rs1=server.CreateObject("ADODB.RecordSet")
set rs1=conn.execute("SELECT * FROM border where typeid="&menuid&" and borderview=1 order by borderorder")
if not rs1.EOF then
do while not rs1.eof
%>
<%if not Rs1.eof then%>
mpmenu<%=menuid%>.addItem(new mMenuItem(' <span style="line-height: 20px;"><%=Rs1("bordername")%>','more.asp?typeid=<%=menuid%>&borderid=<%=Rs1("borderid")%>','self',false,'<%=Rs1("bordername")%>','','','',''));
<%
end if
rs1.movenext
loop
end if
rs1.close
%>
<%
i=i+1
rs.MoveNext
wend
rs.close
set rs=nothing
%>
导航上的菜单是调用数据库中的字段自动生成的
现在想实现这些菜单在>10个后的自动换行功能 展开
2个回答
展开全部
这是你的代码,我要改的是这部分:
set rs1=server.CreateObject("ADODB.RecordSet")
set rs1=conn.execute("SELECT * FROM border where typeid="&menuid&" and borderview=1 order by borderorder")
if not rs1.EOF then
do while not rs1.eof
%>
<%if not Rs1.eof then%>
mpmenu<%=menuid%>.addItem(new mMenuItem(' <span style="line-height: 20px;"><%=Rs1("bordername")%>','more.asp?typeid=<%=menuid%>&borderid=<%=Rs1("borderid")%>','self',false,'<%=Rs1("bordername")%>','','','',''));
<%
end if
rs1.movenext
loop
end if
rs1.close
%>
<%
i=i+1
rs.MoveNext
wend
rs.close
set rs=nothing
改为下面的:
i=1
set rs1=server.CreateObject("ADODB.RecordSet")
set rs1=conn.execute("SELECT * FROM border where typeid="&menuid&" and borderview=1 order by borderorder")
do while not rs1.eof
if i mod 10 = 0 then (这里插入一个你要换行的内容,比如<br>)
mpmenu<%=menuid%>.addItem(new mMenuItem(' <span style="line-height: 20px;"><%=Rs1("bordername")%>','more.asp?typeid=<%=menuid%>&borderid=<%=Rs1("borderid")%>','self',false,'<%=Rs1("bordername")%>','','','',''));
<%
i=i+1
rs.MoveNext
loop
rs.close
set rs=nothing
set rs1=server.CreateObject("ADODB.RecordSet")
set rs1=conn.execute("SELECT * FROM border where typeid="&menuid&" and borderview=1 order by borderorder")
if not rs1.EOF then
do while not rs1.eof
%>
<%if not Rs1.eof then%>
mpmenu<%=menuid%>.addItem(new mMenuItem(' <span style="line-height: 20px;"><%=Rs1("bordername")%>','more.asp?typeid=<%=menuid%>&borderid=<%=Rs1("borderid")%>','self',false,'<%=Rs1("bordername")%>','','','',''));
<%
end if
rs1.movenext
loop
end if
rs1.close
%>
<%
i=i+1
rs.MoveNext
wend
rs.close
set rs=nothing
改为下面的:
i=1
set rs1=server.CreateObject("ADODB.RecordSet")
set rs1=conn.execute("SELECT * FROM border where typeid="&menuid&" and borderview=1 order by borderorder")
do while not rs1.eof
if i mod 10 = 0 then (这里插入一个你要换行的内容,比如<br>)
mpmenu<%=menuid%>.addItem(new mMenuItem(' <span style="line-height: 20px;"><%=Rs1("bordername")%>','more.asp?typeid=<%=menuid%>&borderid=<%=Rs1("borderid")%>','self',false,'<%=Rs1("bordername")%>','','','',''));
<%
i=i+1
rs.MoveNext
loop
rs.close
set rs=nothing
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询