asp图片三行四列显示
这里我的代码,帮忙看看<tablewidth="560"border="0"cellspacing="0"cellpadding="0"><tr><tdalign="ce...
这里我的代码,帮忙看看
<table width="560" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><table border="0" cellpadding="0" cellspacing="8" >
<tr>
<td width="38%" height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td align="center"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" style="border: 1px solid #cccccc">
<tr>
<td align="center">
<!--#include file="conn.asp" -->
<%
set rs=server.createobject("adodb.recordset")
sqls="select * from product order by id desc"
rs.open sqls,conn,1,1
If Not rs.bof and Not rs.eof then
Dim page_size,currentpage,page_total,i,j
page_size=12 '定义显示最大记录数
If request("page")="" then
currentpage=1 '当前所在页数
Else
currentpage=cint(request("page"))
End If
rs.pagesize=page_size
If currentpage>rs.pagecount then
currentpage=rs.pagecount '控制通过链接传过来的最大页数不超过RS数据集的真实页数
End If
rs.Absolutepage=currentpage '控制RS数据集跳到对应页内的记录
page_total=rs.pagecount
j=page_size
Do while not rs.eof i=i+1 and j>0
j=j-1
%> <a href="xianche2.asp?ag=<%=rs("id")%>">
<img src="<%=rs("url")%>"width="100" height="100" border="0" /></a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="22" align="center" bgcolor="#EBEBEB"><%=rs("Title")%></a></td></tr>
</table></td>
</tr>
</table><%
if I mod 4 = 0 Then Response.write("</tr><tr>") '
rs.movenext
Loop
End If
%><%
response.write"每页9条 共"&rs.recordcount&"条 页次:"¤tpage&"/"&page_total&" <a href='chanpinzhanshi.asp'>首页</a> "
If currentpage=1 then
response.write"上一页 "
else
response.write"<a href='chanpinzhanshi.asp?page="¤tpage-1&"'>上一页</a> "
end if
If currentpage=page_total then
response.write"下一页 "
else
response.write"<a href='chanpinzhanshi.asp?page="¤tpage+1&"'>下一页</a> "
end If
response.write"<a href='chanpinzhanshi.asp?page="&page_total&"'>末页</a> "
%></td>
</tr>
</table>
本人新手,请高手指教 展开
<table width="560" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><table border="0" cellpadding="0" cellspacing="8" >
<tr>
<td width="38%" height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td align="center"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" style="border: 1px solid #cccccc">
<tr>
<td align="center">
<!--#include file="conn.asp" -->
<%
set rs=server.createobject("adodb.recordset")
sqls="select * from product order by id desc"
rs.open sqls,conn,1,1
If Not rs.bof and Not rs.eof then
Dim page_size,currentpage,page_total,i,j
page_size=12 '定义显示最大记录数
If request("page")="" then
currentpage=1 '当前所在页数
Else
currentpage=cint(request("page"))
End If
rs.pagesize=page_size
If currentpage>rs.pagecount then
currentpage=rs.pagecount '控制通过链接传过来的最大页数不超过RS数据集的真实页数
End If
rs.Absolutepage=currentpage '控制RS数据集跳到对应页内的记录
page_total=rs.pagecount
j=page_size
Do while not rs.eof i=i+1 and j>0
j=j-1
%> <a href="xianche2.asp?ag=<%=rs("id")%>">
<img src="<%=rs("url")%>"width="100" height="100" border="0" /></a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="22" align="center" bgcolor="#EBEBEB"><%=rs("Title")%></a></td></tr>
</table></td>
</tr>
</table><%
if I mod 4 = 0 Then Response.write("</tr><tr>") '
rs.movenext
Loop
End If
%><%
response.write"每页9条 共"&rs.recordcount&"条 页次:"¤tpage&"/"&page_total&" <a href='chanpinzhanshi.asp'>首页</a> "
If currentpage=1 then
response.write"上一页 "
else
response.write"<a href='chanpinzhanshi.asp?page="¤tpage-1&"'>上一页</a> "
end if
If currentpage=page_total then
response.write"下一页 "
else
response.write"<a href='chanpinzhanshi.asp?page="¤tpage+1&"'>下一页</a> "
end If
response.write"<a href='chanpinzhanshi.asp?page="&page_total&"'>末页</a> "
%></td>
</tr>
</table>
本人新手,请高手指教 展开
2个回答
2009-05-28
展开全部
record=1
while(record>pagesize)
{
respose.write "tr"
respose.write "td"
rs.movenext
respose.write "td"
rs.movenext
respose.write "td"
rs.movenext
respose.write "td"
rs.movenext
respose.write "/tr"
record=record+1
}
大致就这样的,分页你自己去分,就这思路。
while(record>pagesize)
{
respose.write "tr"
respose.write "td"
rs.movenext
respose.write "td"
rs.movenext
respose.write "td"
rs.movenext
respose.write "td"
rs.movenext
respose.write "/tr"
record=record+1
}
大致就这样的,分页你自己去分,就这思路。
展开全部
可以改为sub前台调用。代码如下:
<%
sub pro_info(m)
%>
<table width="500" height="146" border="0" cellpadding="0" cellspacing="0">
<tr>
<%
sql="select * from pro_table order by id desc"
set rs=conn.execute(sql)
if rs.eof or rs.bof then
response.Write("没有信息!")
response.end()
end if
for i=1 to m
%>
<td><table width="27%" height="187" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="173"><img src="web_manage\<%=rs("newstp")%>" width="144" height="173" /></td>
</tr>
<tr>
<td><%=rs("news_title")%></td>
</tr>
</table></td>
<%
if i mod 5 =0 then
response.write("</tr><tr>")
end if
rs.movenext
if rs.eof or rs.bof then
exit for
end if
next
rs.close()
set rs=nothing
%>
</tr>
</table>
<%
end sub
%>
应该能看懂吧!加加分吧 兄弟
<%
sub pro_info(m)
%>
<table width="500" height="146" border="0" cellpadding="0" cellspacing="0">
<tr>
<%
sql="select * from pro_table order by id desc"
set rs=conn.execute(sql)
if rs.eof or rs.bof then
response.Write("没有信息!")
response.end()
end if
for i=1 to m
%>
<td><table width="27%" height="187" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="173"><img src="web_manage\<%=rs("newstp")%>" width="144" height="173" /></td>
</tr>
<tr>
<td><%=rs("news_title")%></td>
</tr>
</table></td>
<%
if i mod 5 =0 then
response.write("</tr><tr>")
end if
rs.movenext
if rs.eof or rs.bof then
exit for
end if
next
rs.close()
set rs=nothing
%>
</tr>
</table>
<%
end sub
%>
应该能看懂吧!加加分吧 兄弟
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询