写个ASP程序

来源:百度知道 编辑:UC知道 时间:2024/05/06 01:18:10
我有个页面
地址是:
http://www.so360.cn/productshow/smalllist0.asp?sortid=2

有个ASP代码是下面这样的

<br>
<%
sortsql="select * from class_2 where sortid="&rssort("sortid")&""
set rssort=conn.execute(sortsql)
if rssort.eof then
response.write"暂无行业分类"
else
do while not rssort.eof
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<TBODY>
<TR>
<TD width="52%" class=padd><img border="0" src="../images/icon_4x7_arrow.gif" width="8" height="7"> <A href="list.asp?typeid=<%=rssort("typeid")%>" class=M><%=rssort("typename")%></A>
<table width="100%&quo

楼主请参考以下代码,至于每于输出多少个,请改动变量B的值即可。
<%
set rs=server.createobject("adodb.recordset")
rs.open "select * from class_3 where typeid="&rssrot("typeid"),conn,1,1
if rs.eof and rs.bof then
response.write "没有分类"
else
dim a,b,c
a=rs.recordcount
b=2 'b代表每行输出多少个
if (a mod b)=0 then
c=a/b
else
c=int(a/b)+1
end if
'通过以上判断得出共多少行,即c
for i=1 to c
if rs.eof then
exit for
end if
for ii=1 to b
if rs.eof then
exit for
end if
response.write "<a href='xxx.asp'>"&rs("thirdname")&"</a>"
rs.movenext
next
response.write "<br>"
next
end if
rs.close
set rs=nothing
%>

response.write("<br");