⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spss.asp

📁 网上商城的设计与实现
💻 ASP
字号:
<%@ LANGUAGE="VBSCRIPT" %>
<!--#include file="conn.asp" -->
<%
spxl=request("spxl")
set rs=server.createobject("adodb.recordset")

sqltext="select * from Product" 

	if request("Product_Name")<>"" then
       sqltext=sqltext &" where  Product_Name like '%"& request("Product_Name") &"%' "
    else
       sqltext=sqltext &" where Product_Name like '%"& "" &"%' "
    end if
    if request("Product_Class")<>"" then
       sqltext=sqltext &" and Class_1 like '%"& request("Product_Class") &"%' "
    end if
rs.open sqltext,conn,1,1

dim MaxPerPage
MaxPerPage=9

'取得页数,并判断用户输入的是否数字类型的数据,如不是将以第一页显示
dim text,checkpage
text="0123456789"
 Rs.PageSize=MaxPerPage
for i=1 to len(request("page"))
   checkpage=instr(1,text,mid(request("page"),i,1))
   if checkpage=0 then
      exit for 
   end if
next

If checkpage<>0 then
      If NOT IsEmpty(request("page")) Then
        CurrentPage=Cint(request("page"))
        If CurrentPage < 1 Then CurrentPage = 1
        If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
      Else
        CurrentPage= 1
      End If
      If not Rs.eof Then Rs.AbsolutePage = CurrentPage end if
Else
   CurrentPage=1
End if

%>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<script>
  function openbag(id) { window.open("eshop.asp?cpbm="+id,"","height=200,width=700,left=190,top=0,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");} 
</script>
<title>产品分类<%= request("Product_Name")%><%= request("Product_Class")%></title>
<href="style.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>

<body>

  <center>
        <div align="center">
          <table border="0" cellpadding="0" cellspacing="0" width="600"  height="92" >
            <tr>
              <td width="100%" height="70">
                <div align="center">
                  <table border="0" cellpadding="0" cellspacing="0" width="100%" height="148" >
                    <tr><td valign="top">

<div align="center">
<%
'假如没有商品时
If rs.eof and rs.bof then 
   response.write "<td><p align='center'><font color='#ff0000'>没有找到符合条件的商品资料</font></p></td>"
   response.end
End if %>
  <table border="0" cellspacing="1" width="100%" bordercolorlight="#006699" bordercolordark="#FFFFFF"  height="55" bgcolor="#000000">
    <tr>
      <td width="16%" align="center" bgcolor="#006699" height="23"><font color="#FFFFFF">商品编号</font></td>
      <td width="34%" align="center" bgcolor="#006699" height="23"><font color="#FFFFFF">商品名称</font></td>
      <td width="18%" align="center" bgcolor="#006699" height="23"><font color="#FFFFFF">会员价</font></td>
      <td width="17%" align="center" bgcolor="#006699" height="23"><font color="#FFFFFF">详细信息</font></td>
      <td width="15%" align="center" bgcolor="#006699" height="23"><font color="#FFFFFF">购买</font></td>
    </tr>

                    <%row_count=1
                    '显示帖子的子程序
					Sub list()%>
                    <%i=0
                     Do While Not rs.EOF%>
      <tr>                    
      <td width="16%" align="center" height="28" bgcolor="#EEEEEE"><%=rs("Product_Id")%></td>
      <td width="34%" align="center" height="28" bgcolor="#EEEEEE" ><%=rs("Product_Name")%></td>
      <td width="18%" align="center" height="28" bgcolor="#EEEEEE"><%=rs("P_NewPrice")%></td>
      <td width="17%" align="center" height="28" bgcolor="#EEEEEE"><a href="spjj.asp?ProductNO=<%=rs("Product_No")%>">详细资料</td>
      <td width="15%" align="center" height="28" bgcolor="#EEEEEE"><a href='javascript:openbag(<%=rs("Product_Id")%>)'><img style="CURSOR: hand" src="images/mybuy.gif" align="absMiddle" border="0"></a></td>
    </tr>
        <%
                        i=i+1
  					    if i >= MaxPerpage then exit do
				    	rs.MoveNext
						Loop
					end Sub
					  %>
<% call list
   If Rs.recordcount > MaxPerPage then
   call showpages
 end if%>
  </table>
</div>
 				</td></tr>
                  </table>

     </div>
              </td>
            </tr>
          </table>
        </div>
<%
'显示翻页的子程序
sub showpages()%>
<table bgColor="#f8e8a0" border="0" cellPadding="0" cellSpacing="0" width="400" >  
<tr><td >

<form method="POST" action="splb.asp">
<INPUT  type=hidden value=<%=spxl%> name=spxl>
<table bgColor="#006699" border="0" cellPadding="0" cellSpacing="0" width="583" height="30">  
   <tr>
    <td  bgcolor="#eeeeee"  width="510">   
<font color="#000000">   
<p align="center">   
<%
   Response.write "<font color='#000000'>页面-> </font>"   
   If currentpage > 1 Then
      response.write "<a href='splb.asp?&page="+cstr(1)+"&spxl="+Cstr(spxl)+"'><font color='#000000'>首页</font></a><font color='#000000'><b>-</b></font>"  
      Response.write "<a href='splb.asp?page="+Cstr(currentpage-1)+"&spxl="+Cstr(spxl)+"'><font color='#000000'>前页</font></a><font color='#000000'><b>-</b></font>"
   Else
      Response.write "<font color='#000000'>首页-</font>"
      Response.write "<font color='#000000'>前页-</font>" 
   End if
   
   If currentpage < Rs.PageCount Then
      Response.write "<a href='splb.asp?page="+Cstr(currentPage+1)+"&spxl="+Cstr(spxl)+"'><font color='#000000'>后页</font></a><font color='#000000'><b>-</b></font>"
      Response.write "<a href='splb.asp?page="+Cstr(Rs.PageCount)+"&spxl="+Cstr(spxl)+"'><font color='#000000'>尾页</font></a>&nbsp;&nbsp;"
   Else
      Response.write "<font color='#000000'>后页-</font>"
      Response.write "<font color='#000000'>尾页</font>&nbsp;&nbsp;"       
   End if
   Response.write "<font color='#000000'>页次:</font>" & "<font color=#FF0000>" & Cstr(CurrentPage) &  "</font>" & "<font color='#000000'>/" & Cstr(rs.pagecount) & "</font>&nbsp;"
   Response.write "<font color=#ff0000>" & Cstr(MaxPerPage) & "</font>" & "<font color='#000000'>种商品/页&nbsp" & "共</font>" & "<font color=#FF0000>" & Cstr(Rs.RecordCount) & "</font>" & "<font color='#000000'>种商品</font>&nbsp;&nbsp;"

response.write "</td><td align='right'>"
response.write "<font color='#000000' >到:</font><input type='text' name='page' size=2 maxlength=3 class=smallInput value="&Currentpage&">&nbsp;"
   response.write "<input class=buttonface type='submit'  value='Go'  name='cndok' style='background-color: #eeeeee'></span>"   
%>    
</font>    
    </td>  
   </tr>
  </table>
  </center>
</td></tr>
</table>
</form>
<%end sub%>
</body>

</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -