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