网站产品展示不能分页,求救!!!

lightraincrh 2009-06-14 10:20:11
'***********************************************
'过程名: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'><form name='showpages' method='Post' action='" & sfilename & "'><tr><td>"
'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:submit()'>"
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 & "</td></tr></form></table>"
response.write strTemp
end sub
...全文
48 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
lightraincrh 2009-06-14
  • 打赏
  • 举报
回复
<% call ShowArticle(12,"","productshow.asp","","") %>
lightraincrh 2009-06-14
  • 打赏
  • 举报
回复
'=================================================
'过程名:ShowArticle
'=================================================
'显示产品列表。格式:call ShowArticle(numbers,filenames,xiajifile,dinggoufile) 参数意义:numbers:每页显示数量 ,filenames:产品类别显示页面,xiajifile:产品内容显示页面,dinggoufile:在线定单页面,自定义某类
sub ShowArticle(numbers,filenames,xiajifile,dinggoufile,lei)

If lei<>"" Then BigClassName=lei
ShowSmallClassType=ShowSmallClassType_Default

MaxPerPage=numbers

strFileName=filenames & "?BigClassName=" & BigClassName & "&SmallClassName=" & SmallClassName

TitleLen=100
if TitleLen<0 or TitleLen>200 then
TitleLen=50
end if
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
sqlArticle="select top " & MaxPerPage
else
sqlArticle="select "
end if

sqlArticle=sqlArticle & " * from Product where Passed=True "

if BigClassName<>"" then
sqlArticle=sqlArticle & " and BigClassName='" & BigClassName & "' "
if SmallClassName<>"" then
sqlArticle=sqlArticle & " and SmallClassName='" & SmallClassName & "' "
end if
else
if SpecialName<>"" then
sqlArticle=sqlArticle & " and SpecialName='" & SpecialName & "' "
end if
end if
sqlArticle=sqlArticle & " order by Orderid Asc,articleid desc"
Set rsArticle= Server.CreateObject("ADODB.Recordset")
rsArticle.open sqlArticle,conn,1,1
'Response.Write sqlArticle
'Response.End

if rsArticle.bof and rsArticle.eof then
response.Write("<br><li>没有任何产品</li>")
else
if currentPage=1 then
call ArticleContent(TitleLen,xiajifile,filenames,dinggoufile)
else
if (currentPage-1)*MaxPerPage<totalPut then
rsArticle.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rsArticle.bookmark
call ArticleContent(TitleLen,xiajifile,filenames,dinggoufile)
else
currentPage=1
call ArticleContent(TitleLen,xiajifile,filenames,dinggoufile)
end if
end if
end if
rsArticle.close
set rsArticle=nothing

call showpage(strFileName,totalput,MaxPerPage,false,true,"个产品")
'Response.Write strFileName
'response.end
end sub

sub ArticleContent(intTitleLen,xiajifile,filenames,dinggoufile)
dim i,strTemp
i=0
%>
<link href="../css/css.css" rel="stylesheet" type="text/css" />

<table width="100%" border="0" align="center" cellpadding="0" cellspacing="5">
<tr>
<%
do while not rsArticle.eof
strTemp=""
%>
<td valign="center" ><div align="center"><a href="<%=xiajifile%>?ArticleID=<%=rsArticle("articleid")%>"><img src="<%=rsArticle("DefaultPicUrl")%>" width="134" height="122" hspace="10" border="0" /></a><p><a href="<%=xiajifile%>?ArticleID=<%=rsArticle("articleid")%>" style="font-size:12px;color:#666"><u><%=rsArticle("Title")%></u></a></p></div></td>
<!--td height="163" valign="top" style="border-bottom:1px dotted #000000">
<span style="padding:15px"><%'=left(rsArticle("Key"),150)%></span></td-->
<%
response.write strTemp
rsArticle.movenext
i=i+1
If i mod 3=0 Then Response.Write "</tr><tr>"
if i>=MaxPerPage then exit do
loop%>
</tr>
<!--tr>
<td valign="top" class="txt-2"><p class="txt-1"><a href=<%'=xiajifile%>?ArticleID=<%'=rsArticle("articleid")%>><font color=red><u>详细介绍>></u></font></a></p> </td>
</tr-->
</table>
<%
end sub

sub ArticleContent11(intTitleLen,xiajifile,filenames,dinggoufile)
dim i,strTemp
i=0
do while not rsArticle.eof
strTemp=""
%>
<table width=100% border=0 cellspacing=3 cellpadding=0>
<tr>
<td width=25% rowspan=5>
<div align=center><a href=<%=xiajifile%>?ArticleID=<%=rsArticle("articleid")%>>
<img border=0 src=<%=rsArticle("DefaultPicUrl")%> width=100 height=120>
</a></div></td>
<td width=12% height=18>
产品名称:</td>
<td>
<a href=<%=xiajifile%>?ArticleID=<%=rsArticle("articleid")%>><%=rsArticle("Title")%>
</a></td>
</tr><tr>
<td height=18>
产品类别:</td>
<td><a href=<%=filenames%>?BigClassName=<%=rsArticle("BigClassName")%>><%=rsArticle("BigClassName")%></a> →
<a href=<%=filenames%>?BigClassName=<%=rsArticle("BigClassName")%>&SmallClassName=<%=rsArticle("SmallClassName")%>><%=rsArticle("SmallClassName")%>
</a></td>
</tr><tr>
<td height=18>
产品编号:</td>
<td><%=rsArticle("Product_Id")%></td>
</tr><tr>
<td height=18>产品信息:</td>
<td>
<a href=<%=xiajifile%>?ArticleID=<%=rsArticle("articleid")%>><img src=Img/arrow_7.gif border=0></a></td>
</tr><tr>
<td colspan=2>
<!--table width=100% border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=50% height=18>
<div align=center></div></td>
<td width=50% height=18>
<div align=center><a href='<%'=dinggoufile%>?Product_Id=<%'=rsArticle("Product_Id")%>'><img border=0 src=img/addtocart.gif width=75 height=18>
</a><a href='javascript:eshop(<%'=rsArticle("Product_Id")%>)'>加入购物车</a></div></td>
</tr>
</table-->
</td>
</tr><tr>
<td height=1 colspan=3 bgcolor=#CCCCCC></td>
</tr>
</table>
<%
response.write strTemp
rsArticle.movenext
i=i+1
if i>=MaxPerPage then exit do
loop
end sub

28,406

社区成员

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

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