| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 523 人关注过本帖
标题:[求助]分页显示的问题.拜托大家,请帮帮我
只看楼主 加入收藏
丫Y
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2007-2-27
收藏
 问题点数:0 回复次数:2 
[求助]分页显示的问题.拜托大家,请帮帮我

图片原来是按adddate(添加时间排列的),为了方便修改,我把代码改成按id(自动生成的)排列.我改了这一个单词之后网页出现了问题
http://www.rucycat.net/b2b_cplist.asp?page=1&catid=437

原来没有虚框现在出现了虚框.而且分页显示也出问题了.只能看到第一页这16个图片,之后几页没有任何显示.但能读出数据库中catid=437的记录数目.之后我把id再次换成adddate,只是图片的顺便按adddate重新排列了一次,虚框依然存在.翻页依然无显示.

以下是代码,求各位帮帮忙


<!--#include file="conn.asp"-->
<!--#include file="buy2buysys.asp"-->
<!--#include file="top.htm"-->

<%
dim catid,i,strcat
catid=SafeRequest("catid",1)
CatList =catid
PID = catid
if catid="" or catid = 0 then
conn.close
set conn = Nothing
response.Redirect "procat.asp"
response.end
end if

set rs=server.CreateObject("adodb.recordset")
do while not PID = 0
rs.open "Select categoryid,category,ParentID From category Where categoryid="&PID,conn,1,1

if rs.eof and rs.bof then
response.Write "<script LANGUAGE='javascript'>alert('您输入的参数非法,请正确操作!');history.go(-1);</script>"
rs.close
set rs = Nothing
conn.Close
set conn=nothing
response.end
end if

lstcat = "-&gt;<a href=b2b_cplist.asp?catid="&rs("categoryid")&">"&"<font color='#ff229a' face='隶书' size=3>"&rs("category")&"</font>"&"</a>"&lstcat
catstr = ""&rs("category")&"-&gt;"&catstr
CaID = PID
CatN = rs("category")
PID = rs("ParentID")
rs.close
loop

rs.open "Select category,meta From category Where categoryid="&catid,conn,1,1
strcat = rs("category")
strmeta = rs("meta")
strintro = rs("intro")
rs.close
set rs = Nothing
%>

<!--#include file="b2b_includefile/b2b_top2.asp" -->

<table width="950" border="0" cellspacing="0" cellpadding="0" height="237" align="center">
<tr>
<td valign="top" width="538"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="665" height="370">
<param name=movie value="pic/1150685631.swf">
<param name=quality value=high>
<embed src="pic/1150685631.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="665" height="370">
</embed>
</object></td>
<td valign="top" width="412"><img src="pic/you-1.gif" width="244" height="369" border="0" usemap="#Map">
<map name="Map">
<area shape="rect" coords="140,201,231,217" href="help.asp?action=law">
</map>
</td>
</tr>
</table>
<table width="970" border="0" cellspacing="0" cellpadding="0" height="13" align="center">
<tr>
<td valign="top" width="170" height="228">
<table width="170" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="pic/z-1.gif" width="170" height="220"></td>
</tr>
<tr>
<td height="192">
<!--#include file="b2b_includefile/b2b_leftmenu.asp" -->
</td>
</tr>
<tr>
<td><img src="pic/z-2.gif" width="170" height="45"></td>
</tr>
</table>
<table width="170" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><a href="guest.asp"><img src="pic/z-x-1.gif" width="170" height="96" border="0"></a></td>
</tr>
<tr>
<td><a href="help.asp?action=support"><img src="pic/z-x-2.gif" width="170" height="104" border="0"></a></td>
</tr>
<tr>
<td><a href="help.asp?action=law"><img src="pic/z-x-3.gif" width="170" height="104" border="0"></a></td>
</tr>
</table>
<table width="170" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<p><img src="pic/zxia-1.jpg" width="169" height="208"><br>
<img src="pic/zxia-2.gif" width="169" height="242"></p>
<p><img src="pic/zxia-3.gif" width="170" height="400"></p>
</td>
</tr>
</table>
</td>
<td valign="top" width="705" height="228" bgcolor="#c1e7f2">
<table width="75%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td valign="top"><table width="725" border="0" align="right" cellpadding="0" cellspacing="0" bgcolor="#FEA164">
<tr>
<td width="725" height="75"><table border="0" cellpadding="0" cellspacing="0" width="725">
<!-- fwtable fwsrc="cplisttop.png" fwbase="cplisttop.gif" fwstyle="Dreamweaver" fwdocid = "1730942030" fwnested="1" -->
<tr>
<td><img name="cplisttop_01" src="image/cplisttop_01.gif" width="725" height="15" border="0" alt=""></td>
</tr>
<tr>
<td><table align="left" border="0" cellpadding="0" cellspacing="0" width="725">
<tr>
<td><img name="cplisttop_02" src="image/cplisttop_02.gif" width="19" height="30" border="0" alt=""></td>
<td width="685" height="30" background="image/cplisttop_03.gif" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="95%" align="right"><strong><font color="#ff229a" face="隶书" size="4" >您现在的位置:</font>
<%
response.write "<a href='index.asp'><font color='#ff229a' face='隶书' size=3>商城首页</a>"&lstcat '再要显示的地方调用这段就可以了
%>
</font></strong></td>
<td width="5%">&nbsp;</td>
</tr>
</table></td>
<td><img name="cplisttop_04" src="image/cplisttop_04.gif" width="21" height="30" border="0" alt=""></td>
</tr>
</table></td>
</tr>
<tr>
<td><img name="cplisttop_05" src="image/cplisttop_05.gif" width="725" height="30" border="0" alt=""></td>
</tr>
</table>
</td>
</tr>

<tr>
<td bgcolor="#FFFFFF"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" bgcolor="#F7F7F7"><%
Const MaxPerPage=16
dim totalPut
dim CurrentPage
dim TotalPages
dim j
dim sql
if Not isempty(SafeRequest("page",1)) then
currentPage=Cint(SafeRequest("page",1))
else
currentPage=1
end if

set rs=server.CreateObject("adodb.recordset")
rs.open "select prename,company,mark,intro,name,id,introduce,price1,price2,discount,pic,stock,spic from product where categoryid in ("& CatList&") and stock >= 0 and recommend<>3 order by id desc",conn,1,1
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
end if

sub showContent
dim i,t
i=0
t=1

%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<%
do while not rs.eof
%>
<tr>
<%
for t=1 to 4
if not rs.eof then
%>
<td align="center"><TABLE WIDTH="140" HEIGHT="140" BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD width="140" height="140" colspan="2" align="center" background="image/cplistbg.jpg"><a href=b2b_cpinfo.asp?id=<% = rs("id") %> target="_blank">
<% if trim(rs("spic"))<>"" then %>
<img src=image\<% = trim(rs("spic"))%> border=0 width="130" height="130"></a>
<% else %>
<img src=images/emptybook.jpg border=0 width="130" height="130">
<% end if %> </TD>
</TR>
<tr>
<td align="center"><%=trim(rs("name"))%></td>
</tr>
<tr>
<td align="center"><% if rs("stock") > 0 then %>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="93%" align="center"><FONT COLOR=#ff0000>市场价:</FONT><FONT COLOR=#000000><%=trim(rs("price1"))%>元</FONT><br>
<b>会员价:<FONT COLOR=#ff0000><%=trim(rs("price2"))%>元 </FONT></b></td>
<td width="7%" align="center"><a href="b2b_cpinfo.asp?id=<%=rs("id")%>" target="_blank"><img src="image/but_bbogi.gif" width="14" height="16" border="0" align="absmiddle"></a><br>
<a href="####" onClick="MM_openBrWindow('check.asp?ProdId=<%=rs("id")%>','','scrollbars=yes,width=760,height=500')"><img src="image/but_bbogi2.gif" alt="购物车" width="14" height="14" border="0"></a></td>
</tr>
</table></td>
<%else%>
暂时缺货
<% end if%>
</tr>
</TABLE></td>
<%
else

end if
if t<>4 then
rs.movenext
end if
next
%>
</tr>
<%
i=i+5
if i>=MaxPerPage then Exit Do
rs.movenext
loop
rs.close
set rs=nothing
%>
<%
End Sub

Function showpage(totalnumber,maxperpage,filename)
Dim n

If totalnumber Mod maxperpage=0 Then
n= totalnumber \ maxperpage
Else
n= totalnumber \ maxperpage+1
End If %>
<form method=Post action=<% = filename %>?catid=<% = catid %>>
<%
If CurrentPage<2 Then %>
<div align="center">

首页 上页
<% Else %>
<div align="center">

<a href=<% = filename %>?page=1&catid=<% = catid %>>首页</a> <a href=<% = filename %>?page=<% = CurrentPage-1 %>&catid=<% = catid %>>上页</a>
<%
End If
If n-currentpage<1 Then %>
下页 尾页
<% Else %>
<a href=<% = filename %>?page=<% = (CurrentPage+1) %>&catid=<% = catid %>>下页</a> <a href=<% = filename %>?page=<% = n %>&catid=<% = catid %>>尾页</a>
<% End If %>
第 <b>
<% = CurrentPage %>
</b>页 共 <b>
<% = n %>
</b>页 共 <b>
<% = totalnumber %>
</b>件商品 每页 <b>
<% = maxperpage %>
</b> 件商品 转到第:
<input class='input_sr' type='text' name='page' size=2 maxlength=10 value=<% = currentpage %>>

<input type='submit' class='input_bot' value='跳转' name='cndok'>
</form>
<%
End Function
%>
</table></td>
</tr>
<tr>
<td bgcolor="#EAEAEA"><%showpage totalput,MaxPerPage,"b2b_cplist.asp"%></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
<table width="75%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td valign="top">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
<!--#include file="foot.htm"-->
</body>
</html>

搜索更多相关主题的帖子: 数据库 adddate catid 排列 
2007-02-27 11:15
qing_qing
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-1-19
收藏
得分:0 
回复:(丫Y)[求助]分页显示的问题.拜托大家,请帮帮我...

我的代码和你的差不多,不过是"参数catid必须为数字型,请正确操作!"的问题。
请大侠帮助解决。程序如下:
<!--#include file="conn.asp"-->
<!--#include file="buy2buysys.asp"-->
<%
dim catid,i,strcat
catid=SafeRequest("catid",1)
CatList =catid
PID = catid
if catid="" or catid = 0 then
conn.close
set conn = Nothing
response.Redirect "procat.asp"
response.end
end if

set rs=server.CreateObject("adodb.recordset")
do while not PID = 0
rs.open "Select categoryid,category,ParentID From category Where categoryid="&PID,conn,1,1

if rs.eof and rs.bof then
response.Write "<script LANGUAGE='javascript'>alert('您输入的参数非法,请正确操作!');history.go(-1);</script>"
rs.close
set rs = Nothing
conn.Close
set conn=nothing
response.end
end if

lstcat = "-&gt;<a href=b2b_cplist.asp?catid="&rs("categoryid")&">"&rs("category")&"</a>"&lstcat
catstr = ""&rs("category")&"-&gt;"&catstr
CaID = PID
CatN = rs("category")
PID = rs("ParentID")
rs.close
loop

rs.open "Select category,meta From category Where categoryid="&catid,conn,1,1
strcat = rs("category")
strmeta = rs("meta")
strintro = rs("intro")
rs.close
set rs = Nothing
%>

<html>
<style type="text/css">
<!--
.style1 {color: #999999}
.style2 { color: #FF6600;
font-weight: bold;
}
-->
</style>
<head>
<title><%=webname%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #ffffff;
}
-->
</style></head>
<body>
<!--#include file="b2b_includefile/b2b_top.asp" -->
<table width="918" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="image/flpic5_01.jpg" width="185"></td>
</tr>
<tr>
<td height="120" background="image/flpic5_02.jpg"><!-- #include file="login.asp"--></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="60" valign="bottom"><img src="image/flpic1_01.jpg" width="185" height="50"></td>
</tr>
<tr>
<td align="center" background="image/flpic6_02.jpg"><!--#include file="b2b_includefile/b2b_leftmenu.asp" --></td>
</tr>
</table>
</td>
<td width="733" valign="top"><table width="725" border="0" align="right" cellpadding="0" cellspacing="0" bgcolor="#FEA164">
<tr>
<td width="725" height="75"><table border="0" cellpadding="0" cellspacing="0" width="725">
<!-- fwtable fwsrc="cplisttop.png" fwbase="cplisttop.gif" fwstyle="Dreamweaver" fwdocid = "1730942030" fwnested="1" -->
<tr>
<td><img name="cplisttop_01" src="image/cplisttop_01.gif" width="725" height="15" border="0" alt=""></td>
</tr>
<tr>
<td><table align="left" border="0" cellpadding="0" cellspacing="0" width="725">
<tr>
<td><img name="cplisttop_02" src="image/cplisttop_02.gif" width="19" height="30" border="0" alt=""></td>
<td width="685" height="30" background="image/cplisttop_03.gif" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="95%" align="right"><strong>您现在的位置:
<%
response.write "<a href='index.asp'>商城首页</a>"&lstcat '再要显示的地方调用这段就可以了
%>
</strong></td>
<td width="5%">&nbsp;</td>
</tr>
</table></td>
<td><img name="cplisttop_04" src="image/cplisttop_04.gif" width="21" height="30" border="0" alt=""></td>
</tr>
</table></td>
</tr>
<tr>
<td><img name="cplisttop_05" src="image/cplisttop_05.gif" width="725" height="30" border="0" alt=""></td>
</tr>
</table>
</td>
</tr>

<tr>
<td bgcolor="#FFFFFF"><table width="100%" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" bgcolor="#F7F7F7"><%
Const MaxPerPage=30
dim totalPut
dim CurrentPage
dim TotalPages
dim j
dim sql
if Not isempty(SafeRequest("page",1)) then
currentPage=Cint(SafeRequest("page",1))
else
currentPage=1
end if

set rs=server.CreateObject("adodb.recordset")
rs.open "select prename,company,mark,intro,name,id,introduce,price1,price2,discount,pic,stock,spic from product where categoryid in ("& CatList&") and stock >= 0 and recommend<>3 order by adddate desc",conn,1,1
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
end if

sub showContent
dim i,t
i=0
t=1

%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<%
do while not rs.eof
%>
<tr>
<%
for t=1 to 5
if not rs.eof then
%>
<td align="center"><TABLE WIDTH="140" HEIGHT="140" BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD width="140" height="140" colspan="2" align="center" background="image/cplistbg.jpg"><a href=b2b_cpinfo.asp?id=<% = rs("id") %> target="_blank">
<% if trim(rs("spic"))<>"" then %>
<img src=image\<% = trim(rs("spic"))%> border=0 width="130" height="130"></a>
<% else %>
<img src=images/emptybook.jpg border=0 width="130" height="130">
<% end if %> </TD>
</TR>
<tr>
<td align="center"><%=trim(rs("name"))%></td>
</tr>
<tr>
<td align="center"><% if rs("stock") > 0 then %>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="93%" align="center">市场价:<%=trim(rs("price1"))%>元<br>
<b>会员价:<FONT COLOR=#ff0000><%=trim(rs("price2"))%>元 </FONT></b></td>
<td width="7%" align="center"><a href="b2b_cpinfo.asp?id=<%=rs("id")%>" target="_blank"><img src="image/but_bbogi.gif" width="14" height="16" border="0" align="absmiddle"></a><br>
<a href="####" onClick="MM_openBrWindow('check.asp?ProdId=<%=rs("id")%>','','scrollbars=yes,width=760,height=500')"><img src="image/but_bbogi2.gif" alt="购物车" width="14" height="14" border="0"></a></td>
</tr>
</table></td>
<%else%>
暂时缺货
<% end if%>
</tr>
</TABLE></td>
<%
else

end if
if t<>5 then
rs.movenext
end if
next
%>
</tr>
<%
i=i+5
if i>=MaxPerPage then Exit Do
rs.movenext
loop
rs.close
set rs=nothing
%>
<%
End Sub

Function showpage(totalnumber,maxperpage,filename)
Dim n

If totalnumber Mod maxperpage=0 Then
n= totalnumber \ maxperpage
Else
n= totalnumber \ maxperpage+1
End If %>
<form method=Post action=<% = filename %>?catid=<% = catid %>>
<%
If CurrentPage<2 Then %>
<div align="center">

首页 上页
<% Else %>
<div align="center">

<a href=<% = filename %>?page=1&catid=<% = catid %>>首页</a> <a href=<% = filename %>?page=<% = CurrentPage-1 %>&catid=<% = catid %>>上页</a>
<%
End If
If n-currentpage<1 Then %>
下页 尾页
<% Else %>
<a href=<% = filename %>?page=<% = (CurrentPage+1) %>&catid=<% = catid %>>下页</a> <a href=<% = filename %>?page=<% = n %>&catid=<% = catid %>>尾页</a>
<% End If %>
第 <b>
<% = CurrentPage %>
</b>页 共 <b>
<% = n %>
</b>页 共 <b>
<% = totalnumber %>
</b>件商品 每页 <b>
<% = maxperpage %>
</b> 件商品 转到第:
<input class='input_sr' type='text' name='page' size=2 maxlength=10 value=<% = currentpage %>>

<input type='submit' class='input_bot' value='跳转' name='cndok'>
</form>
<%
End Function
%>
</table></td>
</tr>
<tr>
<td bgcolor="#EAEAEA"><%showpage totalput,MaxPerPage,"b2b_cplist.asp"%></td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
</table>
<!--#include file="b2b_includefile/b2b_ver.asp" -->
</body>
</html>

2007-03-13 15:04
qing_qing
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-1-19
收藏
得分:0 
回复:(丫Y)[求助]分页显示的问题.拜托大家,请帮帮我...
自己先顶一下。
2007-03-13 15:07
快速回复:[求助]分页显示的问题.拜托大家,请帮帮我
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.028658 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved