如何改成分页的代码
<tr><%Setrs=Server.CreateObject("ADODB.Recordset")sql="Select*Fromcontentwherefenlei=...
<tr >
<%
Set rs = Server.CreateObject("ADODB.Recordset")
sql ="Select * From content where fenlei='国际国内新闻' Order By id DESC"
RS.open sql,Conn,2,2
do while not rs.eof
%>
<TD width="13" height=25> </TD>
<TD width="355" vAlign=top><a href="read.asp?id=<%=RS("id")%>" class="style17"><li><%if len(rs.Fields.Item("biaoti").Value)>18then
response.Write left(rs.Fields.Item("biaoti").Value,18)&"......"
else
response.Write rs.Fields.Item("biaoti").Value
end if %></li>
</a> </TD>
<td width="124" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="124" height="25" align="center" valign="middle"> <%=year(rs("shijian"))%>-<%=month(rs("shijian"))%>-<%=day(rs("shijian"))%></td>
</tr>
</table> </TD>
</TR>
<tr>
<td height="3"></td>
<td></td>
<td></TD>
</tr>
<%
RS.MoveNext
Loop
rs.close
%>
请高手帮我添加一下分页的代码,以上是显示页面的显示部分代码,谁能帮我填上分页的代码,我送分!
long6062003的 答案点击“下一页“时不变换内容,还是第一页的内容! 展开
<%
Set rs = Server.CreateObject("ADODB.Recordset")
sql ="Select * From content where fenlei='国际国内新闻' Order By id DESC"
RS.open sql,Conn,2,2
do while not rs.eof
%>
<TD width="13" height=25> </TD>
<TD width="355" vAlign=top><a href="read.asp?id=<%=RS("id")%>" class="style17"><li><%if len(rs.Fields.Item("biaoti").Value)>18then
response.Write left(rs.Fields.Item("biaoti").Value,18)&"......"
else
response.Write rs.Fields.Item("biaoti").Value
end if %></li>
</a> </TD>
<td width="124" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="124" height="25" align="center" valign="middle"> <%=year(rs("shijian"))%>-<%=month(rs("shijian"))%>-<%=day(rs("shijian"))%></td>
</tr>
</table> </TD>
</TR>
<tr>
<td height="3"></td>
<td></td>
<td></TD>
</tr>
<%
RS.MoveNext
Loop
rs.close
%>
请高手帮我添加一下分页的代码,以上是显示页面的显示部分代码,谁能帮我填上分页的代码,我送分!
long6062003的 答案点击“下一页“时不变换内容,还是第一页的内容! 展开
1个回答
展开全部
<%
Set rs = Server.CreateObject("ADODB.Recordset")
sql ="Select * From content where fenlei='国际国内新闻' Order By id DESC"
RS.open sql,Conn,2,2
rs.pagesize=14'一页显示的行数,具体一页多少行,改14即可
zongye=rs.pagecount
page=int(request("page"))
if page<=0 then
page=1
end if
if request("page")=" " then
page=1
end if
rs.absolutepage=page
%>
<% for i=1 to rs.pagesize
if rs.eof then
exit for
end if%>
<tr >
<TD width="13" height=25> </TD>
<TD width="355" vAlign=top><a href="read.asp?id=<%=RS("id")%>" class="style17"><li><%if len(rs.Fields.Item("biaoti").Value)>18then
response.Write left(rs.Fields.Item("biaoti").Value,18)&"......"
else
response.Write rs.Fields.Item("biaoti").Value
end if %></li>
</a> </TD>
<td width="124" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="124" height="25" align="center" valign="middle"> <%=year(rs("shijian"))%>-<%=month(rs("shijian"))%>-<%=day(rs("shijian"))%></td>
</tr>
</table> </TD>
</TR>
<%
rs.movenext
next
rs.close
conn.close
%>
<tr>
<td height="3">
<% if page=1 and not page=zongze then %>
第一页 | 上一页 |
<a href="z2.asp?page=<%=page+1%>">下一页</a>
| <a href="z2.asp?page=<%=zongye%>">最后页</a>
<%elseif page<>1 and not page=zongye then %>
<a href="z2.asp?page=1">第一页</a>
| <a href="z2.asp?page=<%=page-1%>">上一页</a>
| <a href="z2.asp?page=<%=page+1%>">下一页</a>
| <a href="z2.asp?page=<%=zongye%>">最后页</a>
<%elseif page=zongye then%>
<a href="z2.asp?page=1">第一页</a>
| <a href="z2.asp?page=<%=page-1%>">上一页</a>
| 下一页 | 最后页
<%end if%>
</td>
</tr>
Set rs = Server.CreateObject("ADODB.Recordset")
sql ="Select * From content where fenlei='国际国内新闻' Order By id DESC"
RS.open sql,Conn,2,2
rs.pagesize=14'一页显示的行数,具体一页多少行,改14即可
zongye=rs.pagecount
page=int(request("page"))
if page<=0 then
page=1
end if
if request("page")=" " then
page=1
end if
rs.absolutepage=page
%>
<% for i=1 to rs.pagesize
if rs.eof then
exit for
end if%>
<tr >
<TD width="13" height=25> </TD>
<TD width="355" vAlign=top><a href="read.asp?id=<%=RS("id")%>" class="style17"><li><%if len(rs.Fields.Item("biaoti").Value)>18then
response.Write left(rs.Fields.Item("biaoti").Value,18)&"......"
else
response.Write rs.Fields.Item("biaoti").Value
end if %></li>
</a> </TD>
<td width="124" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="124" height="25" align="center" valign="middle"> <%=year(rs("shijian"))%>-<%=month(rs("shijian"))%>-<%=day(rs("shijian"))%></td>
</tr>
</table> </TD>
</TR>
<%
rs.movenext
next
rs.close
conn.close
%>
<tr>
<td height="3">
<% if page=1 and not page=zongze then %>
第一页 | 上一页 |
<a href="z2.asp?page=<%=page+1%>">下一页</a>
| <a href="z2.asp?page=<%=zongye%>">最后页</a>
<%elseif page<>1 and not page=zongye then %>
<a href="z2.asp?page=1">第一页</a>
| <a href="z2.asp?page=<%=page-1%>">上一页</a>
| <a href="z2.asp?page=<%=page+1%>">下一页</a>
| <a href="z2.asp?page=<%=zongye%>">最后页</a>
<%elseif page=zongye then%>
<a href="z2.asp?page=1">第一页</a>
| <a href="z2.asp?page=<%=page-1%>">上一页</a>
| 下一页 | 最后页
<%end if%>
</td>
</tr>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询