sub.asp
上传用户:syzzy1975
上传日期:2022-07-17
资源大小:670k
文件大小:6k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
  2. <%
  3. %><!--#include file="manage/inc/config.asp"--> 
  4. <!--#include file="inc/conn.asp"--> 
  5. <%
  6. '开始分页
  7. Const MaxPerPage=5
  8. dim totalPut   
  9. dim CurrentPage
  10. dim TotalPages
  11. dim j
  12. dim sql
  13. dim sortsid
  14. sortsid=request.querystring("nid")
  15. if Not isempty(request("page")) then
  16. currentPage=Cint(request("page"))
  17. else
  18. currentPage=1
  19. end if 
  20. set rs=server.CreateObject("adodb.recordset")
  21. rs.open "select  pagenum,name,mark,vipprice,discount,score,id,author,productdate,price2,price1,discount,pic from product where sortsid="&sortsid&" order by adddate desc",conn,1,1
  22. if err.number<>0 then
  23. call MsgBox("数据库中无数据","Back","None")
  24. response.End
  25. end if
  26. if rs.eof And rs.bof then
  27. call MsgBox("对不起,目前没有更新商品!","Back","None")
  28. response.End
  29. else
  30. totalPut=rs.recordcount
  31. if currentpage<1 then
  32. urrentpage=1
  33. end if
  34. if (currentpage-1)*MaxPerPage>totalput then
  35. if (totalPut mod MaxPerPage)=0 then
  36. currentpage= totalPut  MaxPerPage
  37. else
  38. currentpage= totalPut  MaxPerPage + 1
  39. end if
  40. end if
  41. if currentPage=1 then
  42. else
  43. if (currentPage-1)*MaxPerPage<totalPut then
  44. rs.move  (currentPage-1)*MaxPerPage
  45. dim bookmark
  46.         bookmark=rs.bookmark
  47.         
  48. else
  49. currentPage=1
  50. end if
  51. end if
  52. end if
  53. dim i
  54. i=0
  55. %>
  56. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  57. <html>
  58. <head>
  59. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  60. <title>406网络书店</title>
  61. <link href="style.css" rel="stylesheet" type="text/css">
  62. </head>
  63. <body>
  64. <!--#include file="head.htm"-->
  65. <table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
  66.   <tr>
  67.     <td width="219" align="left" valign="top"><!--#include file="left.asp"--></td>
  68.     <td width="561" align="left" valign="top">      <table width="100%" border="0" cellspacing="0" cellpadding="0">
  69.         <tr>
  70.           <td align="left" valign="top"><br>
  71.           <br></td>
  72.         </tr>
  73.         <tr>
  74.           <td align="center" valign="top"><table width="568"  border="0" cellpadding="0" cellspacing="0">
  75. <%
  76. do while not rs.eof
  77. %>
  78.   <tr>
  79.                 <td width="17%" height="130" align="center" valign="middle" class="shadow"><a href="vpro.asp?id=<%=trim(rs("id"))%>" target="_blank"><img src="<%=trim(rs("pic"))%>" width="85" height="125" border="0"></a></td>
  80.                 <td height="130" align="left" valign="top"><table width="100%"  border="0" cellspacing="2" cellpadding="0">
  81.                   <tr>
  82.                     <td colspan="2"><img src="images/w.gif" width="18" height="18"><span class="booktitle"><%=trim(rs("name"))%></span></td>
  83.                   </tr>
  84.                   <tr class="bookinfo">
  85.                     <td width="50%" height="12" class="bookinfo">作 者:<%=trim(rs("author"))%></td>
  86.                     <td width="50%" class="bookinfo"> 出版社:<%=trim(rs("mark"))%></td>
  87.                   </tr>
  88.                   <tr class="bookinfo">
  89.                     <td width="50%">优惠价: <%=trim(rs("price2"))%></td>
  90.                     <td width="50%">日 期:<%=trim(rs("productdate"))%></td>
  91.                   </tr>
  92.                   <tr class="bookinfo">
  93.                     <td>定 价:<%=trim(rs("price1"))%></td>
  94.                     <td>VIP价格:<%=rs("vipprice")%></td>
  95.                   </tr>
  96.                   <tr class="bookinfo">
  97.                     <td>折 扣:<%=trim(rs("discount")*100)%></td>
  98.                     <td> 积 分:<%=rs("score")%></td>
  99.                   </tr>
  100.                   <tr class="bookinfo">
  101.                     <td width="50%">&nbsp;</td>
  102.                     <td width="50%">&nbsp; </td>
  103.                   </tr>
  104.                   <tr>
  105.                     <td colspan="2" align="center"><a href="icar.asp?id=<%=rs("id")%>&action=add" target="pcart"><img src="images/car.gif" width="23" height="20" border="0">购物车</a></td>
  106.                   </tr>
  107.                 </table></td>
  108.               </tr>
  109.               <tr>
  110.                 <td colspan="2" align="center"><img src="images/line.gif" width="568" height="9"></td>
  111.               </tr>
  112. <%i=i+1
  113. if i>=MaxPerPage then Exit Do
  114. rs.movenext
  115. loop
  116. rs.close
  117. set rs=nothing%>
  118.                                                       <%  
  119.   
  120. Function showpage(totalnumber,maxperpage,filename)  
  121.    Dim n
  122.   
  123. If totalnumber Mod maxperpage=0 Then  
  124. n= totalnumber  maxperpage  
  125. Else
  126. n= totalnumber  maxperpage+1  
  127. End If
  128. Response.Write "<form method=Post action="&filename&">"  
  129. Response.Write "<p align='center' > "  
  130. If CurrentPage<2 Then  
  131. Response.Write "首页 上一页 "  
  132. Else  
  133. Response.Write "<a href="&filename&"?page=1&nid="&sortsid&">首页</a> "  
  134. Response.Write "<a href="&filename&"?page="&CurrentPage-1&"&nid="&sortsid&" >上一页</a> "  
  135. End If
  136. If n-currentpage<1 Then  
  137. Response.Write "下一页 尾页"  
  138. Else  
  139. Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&"&nid="&sortsid&" >"  
  140. Response.Write "下一页</a> <a href="&filename&"?page="&n&"&nid="&sortsid&">尾页</a>"  
  141. End If  
  142. Response.Write " 页次:"&CurrentPage&"/"&n&"页 "  
  143. Response.Write " 共有<b>&nbsp;"&totalnumber&"&nbsp;</b>种商品 "&maxperpage&"种商品/页 " 
  144. Response.Write "转到:<input type='text' name='page' size=2 maxlength=10 class=smallInput value="&currentpage&">"  
  145. Response.Write "&nbsp;<input type='submit'   value='GO' name='cndok'></form>"  
  146. End Function  
  147. %>
  148.   
  149.               <tr align="center">
  150.                 <td colspan="2"><br>
  151.                   <form name="form1" method="get" action="">
  152.   <INPUT TYPE="hidden" name="nid" value="<%=sortsid%>">
  153.                     <%
  154. showpage totalput,MaxPerPage,"sub.asp"
  155. %>
  156.                   </form> </td>
  157.               </tr>
  158.           </table></td>
  159.         </tr>
  160.         <tr>
  161.           <td>&nbsp;</td>
  162.         </tr>
  163.     </table></td>
  164.   </tr>
  165. </table>
  166. <!--#include file="foot.htm"-->
  167. </body>
  168. </html>