如何实现横排和坚排都循环,并且带分页功能

xyj200588 2006-09-12 09:30:08
请问大家如何在ASP中实现横排和坚排都循环,并且带分页功能.
也就是第页的每行显示三行一共四行,多余在下一页显示.
...全文
142 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhangjingcheng 2006-09-13
  • 打赏
  • 举报
回复
是啊
用css+div层都可以的
hurrayboy 2006-09-13
  • 打赏
  • 举报
回复
呵呵~

这样的代码多的是啊~
sy_binbin 2006-09-12
  • 打赏
  • 举报
回复
接上


sql1 = "select * from ProClass order by id"
set rs1 = server.CreateObject("adodb.recordset")
rs1.open sql1,conn,1,1
const MaxPerPage=9
dim totalPut,CurrentPage,TotalPages

end if
strFileName="productList.asp?classId="&rs1("id")
if request("page")<>"" then
currentPage=cint(request("page"))
else
currentPage=1
end if


<%
dim rs,sql
dim classId
dim i_1
i_1=0
classId = request("classId")
sql = "select a.id,ClassName,proName,proImage from product a,proClass b where a.proClassId=b.id and a.proClassId="&classId
set rs = server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.Write "还没有产品!"
else
totalPut=rs.recordcount

if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if

end if
if currentPage=1 then
showContent
showpage strFileName,totalput,MaxPerPage,true,true,"条数据"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage strFileName,totalput,MaxPerPage,true,true,"条数据"
else
currentPage=1
showContent
showpage strFileName,totalput,MaxPerPage,true,true,"条数据"
end if
end if

set rs=Nothing
sub showContent()
dim i
i=0
%>
<table width="100%" height="20" border="0" cellpadding="2" cellspacing="2">
<tr>
<%
do while not rs.eof
i_1=i_1+1
%>
<td height="16" align="center"><table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td align="center"><table width="131" border="0" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC" onmouseover="this.style.backgroundColor='#FF4FAE'" onmouseout="this.style.backgroundColor=''">
<tr>
<td bgcolor="#FFFFFF"><img src="<%=rs("proImage")%>" width=131 height=89 border=0 align=absmiddle></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center"><div align="center" onClick="MM_openBrWindow('productView.asp?id=<%=rs("id")%>','','scrollbars=yes,width=500,height=400')"><a href="#"><%=rs("proName")%></a></div></td>
</tr>
</table></td>
<%
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
if i_1 mod 3 = 0 then
response.write "</tr><tr>"
end if
loop
rs.close
set rs=nothing
%>
</tr>
</table>
<%end sub%>
<%end if%>
sy_binbin 2006-09-12
  • 打赏
  • 举报
回复
'**************************************************
'函数名:JoinChar
'作 用:向地址中加入 ? 或 &
'参 数:strUrl ----网址
'返回值:加了 ? 或 & 的网址
'**************************************************
function JoinChar(strUrl)
if strUrl="" then
JoinChar=""
exit function
end if
if InStr(strUrl,"?")<len(strUrl) then
if InStr(strUrl,"?")>1 then
if InStr(strUrl,"&")<len(strUrl) then
JoinChar=strUrl & "&"
else
JoinChar=strUrl
end if
else
JoinChar=strUrl & "?"
end if
else
JoinChar=strUrl
end if
end function

'**************************************************
'过程名:showpage
'作 用:显示“上一页 下一页”等信息
'参 数:sfilename ----链接地址
' totalnumber ----总数量
' maxperpage ----每页数量
' ShowTotal ----是否显示总数量
' ShowAllPages ---是否用下拉列表显示所有页面以供跳转。有某些页面不能使用,否则会出现JS错误。
' strUnit ----计数单位
'**************************************************
sub showpage(sfilename,totalnumber,maxperpage,ShowTotal,ShowAllPages,strUnit)
dim n, i,strTemp,strUrl
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
strTemp= "<table align='center'><tr><td><font size='2'>"
if ShowTotal=true then
strTemp=strTemp & "共 <b>" & totalnumber & "</b> " & strUnit & "  "
end if
strUrl=JoinChar(sfilename)
if CurrentPage<2 then
strTemp=strTemp & "首页 上一页 "
else
strTemp=strTemp & "<a href='" & strUrl & "page=1'>首页</a> "
strTemp=strTemp & "<a href='" & strUrl & "page=" & (CurrentPage-1) & "'>上一页</a> "
end if

if n-currentpage<1 then
strTemp=strTemp & "下一页 尾页"
else
strTemp=strTemp & "<a href='" & strUrl & "page=" & (CurrentPage+1) & "'>下一页</a> "
strTemp=strTemp & "<a href='" & strUrl & "page=" & n & "'>尾页</a>"
end if
strTemp=strTemp & " 页次:<strong><font color=red>" & CurrentPage & "</font>/" & n & "</strong>页 "
strTemp=strTemp & " <b>" & maxperpage & "</b>" & strUnit & "/页"
if ShowAllPages=True then
strTemp=strTemp & " 转到:<select name='page' size='1' onchange=""javascript:window.location='" & strUrl & "page=" & "'+this.options[this.selectedIndex].value;"">"
for i = 1 to n
strTemp=strTemp & "<option value='" & i & "'"
if cint(CurrentPage)=cint(i) then strTemp=strTemp & " selected "
strTemp=strTemp & ">第" & i & "页</option>"
next
strTemp=strTemp & "</select>"
end if
strTemp=strTemp & "</font></td></tr></table>"
response.write strTemp
end sub

这个是分页函数
xyj200588 2006-09-12
  • 打赏
  • 举报
回复
也就是
1 2 3
4 5 6
7 8 9


下一页 上一页 最后一页
大家快帮帮我.谢谢

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧