1个回答
展开全部
这个分页类似百度的,稍稍修改一下,就行了
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Products</title>
<%Response.ContentType="text/html; charset=GB2312"%>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="../english/images/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../images/thickbox.css" />
<script language="javascript" type="text/javascript" src="../images/jquery.js" ></script>
<script language="javascript" type="text/javascript" src="../images/thickbox.js" ></script>
<script language="javascript" type="text/javascript" src="../images/global.js" ></script>
<SCRIPT language=JavaScript type=text/JavaScript>
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</SCRIPT>
</head>
<!--#include file="conn2.asp"-->
<%
dim m,n
set rs=server.CreateObject("adodb.recordset")
sqlstr="select * from product order by id desc"
rs.open sqlstr,conn,3,3
on error resume next
rss.movefirst
if err=3021 then
response.write "无数据!"
end if
if rs.eof and rs.bof then
response.Write "<script>alert('产品还没有添加!')</script>"
end if
rs.pagesize=25
'定义一页显示的记录数目
tatalrecord=rs.recordcount '获取记录总数目
tatalpages=rs.pagecount '获取分页的数目
rs.movefirst
nowpage=request("page") '用request获取当前页数,注意page是自己定义的变量并非函数
if nowpage&"x"="x" then '处理页码为空时的情况
nowpage=1
else
nowpage=cint(nowpage) '将页码转换成数字型
end if
rs.absolutepage=nowpage
%>
<body bgcolor="#000000">
<div class="top-1">
<div class="left">
<div class="top1-1"></div>
</div>
<div class="top2-1">
<%
n=1
i=1
do while not rs.eof and n<=rs.pagesize %>
<div class="cp"><a href="product_big.asp?id=<%=rs("id")%>&height=483&width=435" class="thickbox" ><img src="../product/proimg/<%=rs("picname1")%>"/></a><h5>名称:
<%
set rs3=server.CreateObject("Adodb.recordset")
sql3="select * from name WHERE ID=" &RS("pro")
RS3.OPEN SQL3,CONN,1,1
%>
<%=rs3("NAME")%>
<% RS3.CLOSE%></h5><h5>价格: <%=rs("price")%></h5><h5>编号: <%=rs("number")%></h5></div>
<%if i mod 1=0 then%>
<%end if
i=i+1
n=n+1
rs.movenext
loop
%>
<div class="ym">
<%if nowpage>1 then%>
<a href="product.asp?page=<%=nowpage-1%>"><<</a>
<%else%>
<<
<%end if%>
<%for k=1 to tatalpages%>
<%if k<>nowpage then %>
<a href="product.asp?page=<%=k%>"><%=k%></a>
<%else%>
<%=k%>
<%end if%>
<%next%>
<%if nowpage < tatalpages then%>
<a href="product.asp?page=<%=nowpage+1%>">>></a>
<%else%>
>>
<%end if%>
</div>
</div>
<div class="footer">
Copyright 2008 © LOGO All Right Reserved. powered by <a href="http://www.plasticmould.net">Plasticmould.NET</a></div>
</div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Products</title>
<%Response.ContentType="text/html; charset=GB2312"%>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="../english/images/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../images/thickbox.css" />
<script language="javascript" type="text/javascript" src="../images/jquery.js" ></script>
<script language="javascript" type="text/javascript" src="../images/thickbox.js" ></script>
<script language="javascript" type="text/javascript" src="../images/global.js" ></script>
<SCRIPT language=JavaScript type=text/JavaScript>
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</SCRIPT>
</head>
<!--#include file="conn2.asp"-->
<%
dim m,n
set rs=server.CreateObject("adodb.recordset")
sqlstr="select * from product order by id desc"
rs.open sqlstr,conn,3,3
on error resume next
rss.movefirst
if err=3021 then
response.write "无数据!"
end if
if rs.eof and rs.bof then
response.Write "<script>alert('产品还没有添加!')</script>"
end if
rs.pagesize=25
'定义一页显示的记录数目
tatalrecord=rs.recordcount '获取记录总数目
tatalpages=rs.pagecount '获取分页的数目
rs.movefirst
nowpage=request("page") '用request获取当前页数,注意page是自己定义的变量并非函数
if nowpage&"x"="x" then '处理页码为空时的情况
nowpage=1
else
nowpage=cint(nowpage) '将页码转换成数字型
end if
rs.absolutepage=nowpage
%>
<body bgcolor="#000000">
<div class="top-1">
<div class="left">
<div class="top1-1"></div>
</div>
<div class="top2-1">
<%
n=1
i=1
do while not rs.eof and n<=rs.pagesize %>
<div class="cp"><a href="product_big.asp?id=<%=rs("id")%>&height=483&width=435" class="thickbox" ><img src="../product/proimg/<%=rs("picname1")%>"/></a><h5>名称:
<%
set rs3=server.CreateObject("Adodb.recordset")
sql3="select * from name WHERE ID=" &RS("pro")
RS3.OPEN SQL3,CONN,1,1
%>
<%=rs3("NAME")%>
<% RS3.CLOSE%></h5><h5>价格: <%=rs("price")%></h5><h5>编号: <%=rs("number")%></h5></div>
<%if i mod 1=0 then%>
<%end if
i=i+1
n=n+1
rs.movenext
loop
%>
<div class="ym">
<%if nowpage>1 then%>
<a href="product.asp?page=<%=nowpage-1%>"><<</a>
<%else%>
<<
<%end if%>
<%for k=1 to tatalpages%>
<%if k<>nowpage then %>
<a href="product.asp?page=<%=k%>"><%=k%></a>
<%else%>
<%=k%>
<%end if%>
<%next%>
<%if nowpage < tatalpages then%>
<a href="product.asp?page=<%=nowpage+1%>">>></a>
<%else%>
>>
<%end if%>
</div>
</div>
<div class="footer">
Copyright 2008 © LOGO All Right Reserved. powered by <a href="http://www.plasticmould.net">Plasticmould.NET</a></div>
</div>
</body>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询