3个回答
展开全部
if not rs.eof then
rs.PageSize =12 '每页记录条数
result_num1=rs.RecordCount '记录总数
maxpage1=rs.PageCount
page1=request("page1")
if Not IsNumeric(page1) or page1="" then
page1=1
else
page1=cint(page1)
end if
if page1<1 then
page1=1
elseif page1>maxpage1 then
page1=maxpage1
end if
rs.AbsolutePage=Page1
else
result_num1=0
maxpage1=0
page1=0
end if
if not rs.eof then
for i=1 to rs.PageSize
%>
<td><table width="150" height="128" border="0" align="right" cellpadding="0" cellspacing="0" class="home-image-b">
<tr>
<td height="114"><div align="center"><a href="hotelshow.asp?id=<%=rs("id")%>" target="_blank"><img src="admin/<%=rs("logurl")%>" width=141 height=110 border="0"></a></div></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><div align="center"><a href="hotelshow.asp?id=<%=rs("id")%>" target="_blank"><%=rs("c_name")%></a></div></td>
</tr>
</table></td>
<%
if i mod 4=0 then response.write ("</tr><tr>")
rs.movenext
if rs.EOF then Exit For
next
else
response.Write " <td><div align='center'>还没信息!</div></td>"
end if
rs.close
set rs=nothing
%>
</tr>
<tr><td colspan="5" align="center"><% call LastNextPage1(maxpage1,page1,result_num1) %></td></tr>
</table></td>
</tr>
</table>
<%
'=============================================
'名称:LastNextPage
'作用:分页的调用
'=============================================
Sub LastNextPage(pagecount,page,resultcount)
Dim query, a, x, temp
action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")
query = Split(Request.ServerVariables("QUERY_STRING"), "&")
For Each x In query
a = Split(x, "=")
If StrComp(a(0), "page", vbTextCompare) <> 0 Then
temp = temp & a(0) & "=" & a(1) & "&"
End If
Next
Response.Write("<table cellspacing=0 cellpadding=0 border=0>" & vbCrLf )
Response.Write("<form method=get onsubmit=""document.location = '" & action & "?" & temp & "Page='+ this.page.value;return false;""><TR>" & vbCrLf )
Response.Write("<TD align=right>" & vbCrLf )
' Response.Write(font_style & vbCrLf )
if page<=1 then
Response.Write ("首 页 | " & vbCrLf)
Response.Write ("上页 | " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?" & temp & "Page=1>首 页 </A> | " & vbCrLf)
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page-1) & ">上页</A> | " & vbCrLf)
end if
if page>=pagecount then
Response.Write ("下 页 | " & vbCrLf)
Response.Write ("尾 页 | " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page+1) & ">下 页</A> | " & vbCrLf)
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & pagecount & ">尾 页</A> | " & vbCrLf)
end if
Response.Write(" 页次:" & page & "/" & pageCount & "页 | " & vbCrLf)
Response.Write(" 共有" & iCount & "条信息 | " & vbCrLf)
Response.Write(" 转到 " & "<INPUT TYEP=TEXT NAME=page SIZE=1 Maxlength=5 class=sosuo-info VALUE=" & page & ">" & " 页" & vbCrLf & "<INPUT type=image src='Images/go.gif' value=GO>")
Response.Write("</TD>" & vbCrLf )
Response.Write("</TR></form>" & vbCrLf )
Response.Write("</table>" & vbCrLf )
End Sub
%>
rs.PageSize =12 '每页记录条数
result_num1=rs.RecordCount '记录总数
maxpage1=rs.PageCount
page1=request("page1")
if Not IsNumeric(page1) or page1="" then
page1=1
else
page1=cint(page1)
end if
if page1<1 then
page1=1
elseif page1>maxpage1 then
page1=maxpage1
end if
rs.AbsolutePage=Page1
else
result_num1=0
maxpage1=0
page1=0
end if
if not rs.eof then
for i=1 to rs.PageSize
%>
<td><table width="150" height="128" border="0" align="right" cellpadding="0" cellspacing="0" class="home-image-b">
<tr>
<td height="114"><div align="center"><a href="hotelshow.asp?id=<%=rs("id")%>" target="_blank"><img src="admin/<%=rs("logurl")%>" width=141 height=110 border="0"></a></div></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><div align="center"><a href="hotelshow.asp?id=<%=rs("id")%>" target="_blank"><%=rs("c_name")%></a></div></td>
</tr>
</table></td>
<%
if i mod 4=0 then response.write ("</tr><tr>")
rs.movenext
if rs.EOF then Exit For
next
else
response.Write " <td><div align='center'>还没信息!</div></td>"
end if
rs.close
set rs=nothing
%>
</tr>
<tr><td colspan="5" align="center"><% call LastNextPage1(maxpage1,page1,result_num1) %></td></tr>
</table></td>
</tr>
</table>
<%
'=============================================
'名称:LastNextPage
'作用:分页的调用
'=============================================
Sub LastNextPage(pagecount,page,resultcount)
Dim query, a, x, temp
action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")
query = Split(Request.ServerVariables("QUERY_STRING"), "&")
For Each x In query
a = Split(x, "=")
If StrComp(a(0), "page", vbTextCompare) <> 0 Then
temp = temp & a(0) & "=" & a(1) & "&"
End If
Next
Response.Write("<table cellspacing=0 cellpadding=0 border=0>" & vbCrLf )
Response.Write("<form method=get onsubmit=""document.location = '" & action & "?" & temp & "Page='+ this.page.value;return false;""><TR>" & vbCrLf )
Response.Write("<TD align=right>" & vbCrLf )
' Response.Write(font_style & vbCrLf )
if page<=1 then
Response.Write ("首 页 | " & vbCrLf)
Response.Write ("上页 | " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?" & temp & "Page=1>首 页 </A> | " & vbCrLf)
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page-1) & ">上页</A> | " & vbCrLf)
end if
if page>=pagecount then
Response.Write ("下 页 | " & vbCrLf)
Response.Write ("尾 页 | " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page+1) & ">下 页</A> | " & vbCrLf)
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & pagecount & ">尾 页</A> | " & vbCrLf)
end if
Response.Write(" 页次:" & page & "/" & pageCount & "页 | " & vbCrLf)
Response.Write(" 共有" & iCount & "条信息 | " & vbCrLf)
Response.Write(" 转到 " & "<INPUT TYEP=TEXT NAME=page SIZE=1 Maxlength=5 class=sosuo-info VALUE=" & page & ">" & " 页" & vbCrLf & "<INPUT type=image src='Images/go.gif' value=GO>")
Response.Write("</TD>" & vbCrLf )
Response.Write("</TR></form>" & vbCrLf )
Response.Write("</table>" & vbCrLf )
End Sub
%>
展开全部
简单的代码
如果不是从数据库里读取的数据 自己用for语句处理一下一样
分页处根据自己的喜好自己设计就可以了
<%
dim pagesize,page,pagecount,mm
set rs=server.CreateObject("adodb.recordset")
rs.open "select [编号],[图片] from [table]"
if not rs.eof then
pagesize=分页数量
rs.pagesize=pagesize
pagecount=rs.pagecount
page=request.QueryString("page")
if page="" or not isnumeric(page) then
page=1
else
page=int(page)
end if
if page<1 then page=1
if page>pagecount then page=pagecount
rs.absolutepage=page
mm=1
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<%
do while not rs.eof and mm<=rs.pagesize
%>
<td><a href="xxx.asp?id=<%=rs("[编号]")%>"><img src="<%=rs("[图片]")%>" width="宽度" height="高度" border="0"</a></td>
<%
rs.movenext
if (mm mod 4) =0 then
response.Write("</tr><tr>")
mm=mm+1
loop
%>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">总共<%=pagecount%>页 <a href="?page=<%=page-1%>">上一页</a> <a href="?page=<%=page+1%>">下一页</a></td>
</tr>
</table>
<%
end if
rs.close
set rs=nothing
%>
如果不是从数据库里读取的数据 自己用for语句处理一下一样
分页处根据自己的喜好自己设计就可以了
<%
dim pagesize,page,pagecount,mm
set rs=server.CreateObject("adodb.recordset")
rs.open "select [编号],[图片] from [table]"
if not rs.eof then
pagesize=分页数量
rs.pagesize=pagesize
pagecount=rs.pagecount
page=request.QueryString("page")
if page="" or not isnumeric(page) then
page=1
else
page=int(page)
end if
if page<1 then page=1
if page>pagecount then page=pagecount
rs.absolutepage=page
mm=1
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<%
do while not rs.eof and mm<=rs.pagesize
%>
<td><a href="xxx.asp?id=<%=rs("[编号]")%>"><img src="<%=rs("[图片]")%>" width="宽度" height="高度" border="0"</a></td>
<%
rs.movenext
if (mm mod 4) =0 then
response.Write("</tr><tr>")
mm=mm+1
loop
%>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">总共<%=pagecount%>页 <a href="?page=<%=page-1%>">上一页</a> <a href="?page=<%=page+1%>">下一页</a></td>
</tr>
</table>
<%
end if
rs.close
set rs=nothing
%>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
排列代码
<%
Sql="..."
Rs.Open Sql,Conn,1,1
IF Rs.Recordcount>0 Then
Response.Write"<table>"
For i=1 To Rs.recordcount
IF i Mod 4=1 Then Response.Write"<tr>"%>
<td><%=Rs("TUrl") '图片字段%></td>
<%IF i Mod 4=0 Then Response.Write"</tr>"
Rs.Movenext
Next
Response.Write"</table>"%>
<%
Sql="..."
Rs.Open Sql,Conn,1,1
IF Rs.Recordcount>0 Then
Response.Write"<table>"
For i=1 To Rs.recordcount
IF i Mod 4=1 Then Response.Write"<tr>"%>
<td><%=Rs("TUrl") '图片字段%></td>
<%IF i Mod 4=0 Then Response.Write"</tr>"
Rs.Movenext
Next
Response.Write"</table>"%>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询