?? spss.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
'取得頁數(shù),并判斷用戶輸入的是否數(shù)字類型的數(shù)據(jù),如不是將以第一頁顯示
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>產(chǎn)品分類<%= 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> "
Else
Response.write "<font color='#000000'>后頁-</font>"
Response.write "<font color='#000000'>尾頁</font> "
End if
Response.write "<font color='#000000'>頁次:</font>" & "<font color=#FF0000>" & Cstr(CurrentPage) & "</font>" & "<font color='#000000'>/" & Cstr(rs.pagecount) & "</font> "
Response.write "<font color=#ff0000>" & Cstr(MaxPerPage) & "</font>" & "<font color='#000000'>種商品/頁 " & "共</font>" & "<font color=#FF0000>" & Cstr(Rs.RecordCount) & "</font>" & "<font color='#000000'>種商品</font> "
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&"> "
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 + -