ASP图片排列问题
<tablewidth="159"height="221"border="1"><tr><%i=0dowhilenotrs.eof%><tdwidth="149"vali...
<table width="159" height="221" border="1">
<tr>
<%
i=0
do while not rs.eof
%>
<td width="149" valign="top">
<%
if rs.eof and rs.bof then
response.write "</td>"
else
%>
<img name="" src="<%=rs("p_img")%>" width="159" height="201" alt=""></td>
<%
end if
i=i+1
if i mod 4=0 then
response.Write "</tr>"
end if
rs.movenext
loop
%>
</table>
以上代码如何让他分页显示每页最多12张图片 并且加入每一页的链接和最前页 上一页 下一页 最后页 链接的按钮
谢谢各路英雄好汉帮我改一下 万分感谢 展开
<tr>
<%
i=0
do while not rs.eof
%>
<td width="149" valign="top">
<%
if rs.eof and rs.bof then
response.write "</td>"
else
%>
<img name="" src="<%=rs("p_img")%>" width="159" height="201" alt=""></td>
<%
end if
i=i+1
if i mod 4=0 then
response.Write "</tr>"
end if
rs.movenext
loop
%>
</table>
以上代码如何让他分页显示每页最多12张图片 并且加入每一页的链接和最前页 上一页 下一页 最后页 链接的按钮
谢谢各路英雄好汉帮我改一下 万分感谢 展开
展开全部
<%
'PID 页面中的其它传参连接
'page 要显示的页码
'Vcount 总记录数
'Pnum 每页记录数
'className 超连接样式
public function ThePage(Pid,page,Vcount,Pnum,className)
dim show
page = int(page)
Pcount = abs(int(-abs(Vcount/Pnum)))
if page = "" or page <= 0 then page = 1
if page>Pcount then page=Pcount
StartPageNum=1
do while StartPageNum+10<=page
StartPageNum=StartPageNum+10
Loop
EndPageNum=StartPageNum+9
If EndPageNum>Pcount then EndPageNum=Pcount
show = show&"<tr><td colspan='10' bgcolor='' align='right' style='padding-right:25px;padding-top:5px;' class='"&className&"'>"
show = show&"共<b>"&Pcount&"</b>页 共有<b>"&Vcount&"</b>记录 第<b>"&page&"</b>页 跳到第 [ "
if StartPageNum>1 then
show = show&"<a class='"&className&"' href='?"&Pid&"page="&StartPageNum-1&"' title='前十页'><font face='webdings'>7</font></a>"
end if
For go=StartPageNum to EndPageNum
if go<>page then
show = show&"<a class='"&className&"' href='?"&Pid&"page="&go&"'>"&go&"</a>"
else
show = show&"<span class='current'><b>"&go&"</b></span>"
end if
show = show&" "
Next
if EndPageNum<Pcount then
show = show&"<a class='"&className&"' href='?"&Pid&"page="&EndPageNum+1&"' title='下十页'><font face='webdings'>8</font></a>"
end if
show = show& "] 页"
if page<>1 then
show = show&" <a class='"&className&"' href='?"&Pid&"page=1'>首页</a> <a class='"&className&"' href='?"&Pid&"page="&page-1&"'>上一页</a>"
end if
if Pcount-page <> 0 then
show = show& " <a class='"&className&"' href='?"&Pid&"page="&page+1&"'>下一页</a> <a class='"&className&"' href='?"&Pid&"page="&Pcount&"'>尾页</a>"
end if
show=show&"</tr></td>"
ThePage = show
end function
%>
<table width="159" height="221" border="1">
<tr>
<%
sql = "select * from PIC"
set rs = server.CreateObject("ADODB.RECORDSET")
rs.open sql,conn,1,1
page = request("page")
if page = "" then page = 1
'*********分页参数设置*************
'ThePage(Pid,page,Vcount,Pnum,className)
Pid = ""
page = int(page)
Pnum = 12
Vcount = RS.recordcount
className = "f12h25"
if RS.recordcount <> 0 then
RS.absoluteposition=RS.absoluteposition+((abs(page)-1)*Pnum)
end if
'********************************
i = 1
while not RS.eof and i<=Pnum
%>
<td width="149" valign="top">
<img name="" src="<%=rs("p_img")%>" width="159" height="201" alt=""></td>
<%
if i mod 4 =0 and i<>0 then
%>
<tr>
<td height="0"></td>
</tr>
<%
end if
RS.movenext
i=i+1
wend
RS.close
set RS = nothing
%>
<tr>
<td height="14" colspan="3" class="page">
<%=ThePage(Pid,page,Vcount,Pnum,className)%>
</td>
</tr>
</table>
'PID 页面中的其它传参连接
'page 要显示的页码
'Vcount 总记录数
'Pnum 每页记录数
'className 超连接样式
public function ThePage(Pid,page,Vcount,Pnum,className)
dim show
page = int(page)
Pcount = abs(int(-abs(Vcount/Pnum)))
if page = "" or page <= 0 then page = 1
if page>Pcount then page=Pcount
StartPageNum=1
do while StartPageNum+10<=page
StartPageNum=StartPageNum+10
Loop
EndPageNum=StartPageNum+9
If EndPageNum>Pcount then EndPageNum=Pcount
show = show&"<tr><td colspan='10' bgcolor='' align='right' style='padding-right:25px;padding-top:5px;' class='"&className&"'>"
show = show&"共<b>"&Pcount&"</b>页 共有<b>"&Vcount&"</b>记录 第<b>"&page&"</b>页 跳到第 [ "
if StartPageNum>1 then
show = show&"<a class='"&className&"' href='?"&Pid&"page="&StartPageNum-1&"' title='前十页'><font face='webdings'>7</font></a>"
end if
For go=StartPageNum to EndPageNum
if go<>page then
show = show&"<a class='"&className&"' href='?"&Pid&"page="&go&"'>"&go&"</a>"
else
show = show&"<span class='current'><b>"&go&"</b></span>"
end if
show = show&" "
Next
if EndPageNum<Pcount then
show = show&"<a class='"&className&"' href='?"&Pid&"page="&EndPageNum+1&"' title='下十页'><font face='webdings'>8</font></a>"
end if
show = show& "] 页"
if page<>1 then
show = show&" <a class='"&className&"' href='?"&Pid&"page=1'>首页</a> <a class='"&className&"' href='?"&Pid&"page="&page-1&"'>上一页</a>"
end if
if Pcount-page <> 0 then
show = show& " <a class='"&className&"' href='?"&Pid&"page="&page+1&"'>下一页</a> <a class='"&className&"' href='?"&Pid&"page="&Pcount&"'>尾页</a>"
end if
show=show&"</tr></td>"
ThePage = show
end function
%>
<table width="159" height="221" border="1">
<tr>
<%
sql = "select * from PIC"
set rs = server.CreateObject("ADODB.RECORDSET")
rs.open sql,conn,1,1
page = request("page")
if page = "" then page = 1
'*********分页参数设置*************
'ThePage(Pid,page,Vcount,Pnum,className)
Pid = ""
page = int(page)
Pnum = 12
Vcount = RS.recordcount
className = "f12h25"
if RS.recordcount <> 0 then
RS.absoluteposition=RS.absoluteposition+((abs(page)-1)*Pnum)
end if
'********************************
i = 1
while not RS.eof and i<=Pnum
%>
<td width="149" valign="top">
<img name="" src="<%=rs("p_img")%>" width="159" height="201" alt=""></td>
<%
if i mod 4 =0 and i<>0 then
%>
<tr>
<td height="0"></td>
</tr>
<%
end if
RS.movenext
i=i+1
wend
RS.close
set RS = nothing
%>
<tr>
<td height="14" colspan="3" class="page">
<%=ThePage(Pid,page,Vcount,Pnum,className)%>
</td>
</tr>
</table>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询