📄 find.asp
字号:
<%@ Language=VBScript%>
<html>
<head>
<title>都乐书店</title>
<meta http-equiv="introduce-Type" content="text/html; chaRecdet=gb2312">
<link rel="stylesheet" type="text/css" href="css/common.css">
<Script language=javascript>
function setcookie(cookiename, bookid, bookname,publish, unitprice, num)
{
var expiryday = new Date();
expiryday.setTime(expiryday.getTime() + 3*30*60*1*1000);
var valuestr = "bookid" + bookid + "|" +
"bookname" + bookname + "|" +
"publish" + publish + "|" +
"unitprice" + parseFloat(unitprice) + "|" +
"num"+ parseFloat(num);
var namestr = cookiename + "=" + valuestr;
var expirystr = "expires" + "=" + expiryday.toGMTString();
var amount = parseInt(num);
if (!isNaN(amount))
document.cookie = namestr + ";" +
expirystr + ";" +
"path=/";
//window.alert("cookie:" + document.cookie);
}
function addtocart(form) {
if (parseInt(form.num.value) >= 1) {
setcookie("dule"+form.bookid.value,form.bookid.value, form.bookname.value, form.publish.value, form.unitprice.value, form.num.value);
window.alert("'" + form.bookname.value + "' 已放入您的购物车.\n\n" +
"欢迎您继续购物或到收银台结帐.\n");
} else {
window.alert("对不起,请您输入购买数量!");
}
}
</Script>
</head>
<body topmargin=4>
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td><!--#include file="include/title.inc"--></td>
</tr>
<tr>
<td>
<%
if Request("maintype")<>"" then
if Request("secondtype")<>"" then
sql = "select * from books where maintype = '"&Request("maintype")&"' and secondtype = '"&Request("secondtype")&"'"
else
sql = "select * from books where maintype = '"&Request("maintype")&"'"
end if
else if Request("publish")<>"" then
sql = "select * from books where publish like '%"&Request("publish")&"%' or remark like '%"&Request("publish")&"%'"
else if Request("keywords")<>"" then
V=Request("keywords")
sql="select * from books where bookname like '%"&V&"%' or auther like '%"&v&"%' or publish like '%"&V&"%' or remark like '%"&V
sql=sql&"%' order by inputdate"
else
sql = ""
end if
end if
end if
if sql <> "" then
set conn = Server.CreateObject ("ADODB.Connection")
conn.open application("dtbase"),application("user"),application("pwd")
set rsfind = Server.CreateObject ("ADODB.Recordset")
rsfind.Open sql,conn,3
if rsfind.RecordCount > 0 then
findCount = rsfind.RecordCount
PageCount = rsfind.Pagecount
Pagesize = 20
Page= CInt(Request("Page"))
rsfind.pagesize = pagesize
if Page < 1 then Page=1
if page > rsfind.pagecount then page= rsfind.Pagecount
rsfind.AbsolutePage = page
if Request("publish")<>"" then
action="find.asp?publish="&Request("publish")
else if Request("maintype")<>"" then
action="find.asp?maintype="&Request("maintype")&"&secondtype="&Request("secondtype")
else
action="find.asp?keywords="&Request("keywords")
end if
end if
Response.Write "<form action="&action&" method=post style='margin:0'>"
Response.Write "<br>一共找到<span class='color1'>"&rsfind.RecordCount&"</span>本符合要求的书,"
if page<> 1 then
if Request("publish")<>"" then %>
<a href="find.asp?page=<%= page-1 %>&publish=<%= Request("publish") %>">上一页</a>
<%else if Request("maintype")<>"" then%>
<a href="find.asp?page=<%= page-1 %>&maintype=<%= Request("maintype") %>&secondtype=<%=Request("secondtype") %>">上一页</a>
<% else %>
<a href="find.asp?page=<%= page-1%>&keywords=<%= V%>">上一页</a>
<%
end if
end if
end if
if page <> rsfind.Pagecount then
if Request("publish")<>"" then %>
<a href="find.asp?page=<%= page+1 %>&publish=<%= Request("publish") %>">下一页</a>
<%else if Request("maintype")<>"" then%>
<a href="find.asp?page=<%= page+1 %>&maintype=<%= Request("maintype") %>&secondtype=<%=Request("secondtype") %>">下一页</a>
<% else%>
<a href="find.asp?page=<%= page+1%>&keywords=<%= V%>">下一页</a>
<%
end if
end if
end if
Response.Write "请输入页码:<input type=text name=page size=4 maxlength=4 class='inputbox'> "
Response.Write page&"/"&rsfind.pagecount&"</form>"
%>
<table border=0 cellspacing=1 cellpadding=0 width=96% bgcolor=MediumPurple align=center>
<tr bgcolor=#e8e8e8>
<td width=10% height=30>选购</td>
<td width=35% height=30>书名</td>
<td width=18% height=30>作者</td>
<td width=18% height=30>出版社</td>
<td width=14% height=30>出版日期</td>
<td width=6% height=30>价格</td>
</tr>
<%for i = 1 to pagesize%>
<tr bgcolor=#ffffff>
<td>
<form action="" method="post" id=form1 name=form1>
<input type="hidden" name="bookid" value="<%=rsfind("bookid")%>">
<input type="hidden" name="bookname" value="<%=rsfind("bookname")%>">
<input type="hidden" name="publish" value="<%=rsfind("publish") %>">
<input type="hidden" name="unitprice" value="<%=rsfind("unitprice") %>">
<input type=text size=2 maxlength=2 name="num" class="inputbox">
<input value="选定" type="button" alt="订购" class="inputbox" onclick="addtocart(this.form);">
</form>
</td>
<td><a href="display.asp?bookid=<%=rsfind("bookid")%>"><%=rsfind("bookname")%></a></td>
<td><%=rsfind("auther")%></td>
<td><%=rsfind("publish")%></td>
<td><%=rsfind("publishdate")%></td>
<td><%=rsfind("unitprice")%></td>
</tr>
<%
rsfind.MoveNext
if rsfind.EOF then exit for
next
%>
</table>
<%
Response.Write "<form action="&action&" method=post style='margin:0' id=form2 name=form2>"
Response.Write "一共找到<span class='color1'>"&rsfind.RecordCount&"</span>本符合要求的书,"
if page<> 1 then
if Request("publish")<>"" then %>
<a href="find.asp?page=<%= page-1 %>&publish=<%= Request("publish") %>">上一页</a>
<%else if Request("maintype")<>"" then%>
<a href="find.asp?page=<%= page-1 %>&maintype=<%= Request("maintype") %>&secondtype=<%=Request("secondtype") %>">上一页</a>
<% else %>
<a href="find.asp?page=<%= page-1%>&keywords=<%= V%>">上一页</a>
<%
end if
end if
end if
if page <> rsfind.Pagecount then
if Request("publish")<>"" then %>
<a href="find.asp?page=<%= page+1 %>&publish=<%= Request("publish") %>">下一页</a>
<%else if Request("maintype")<>"" then%>
<a href="find.asp?page=<%= page+1 %>&maintype=<%= Request("maintype") %>&secondtype=<%=Request("secondtype") %>">下一页</a>
<% else%>
<a href="find.asp?page=<%= page+1%>&keywords=<%= V%>">下一页</a>
<%
end if
end if
end if
Response.Write "请输入页码:<input type=text name=page size=4 maxlength=4 class='inputbox'> "
Response.Write page&"/"&rsfind.pagecount&"</form>"
else
Response.Write "<p> </p><p align=center style='font-size:14px'>对不起!都乐书店暂时没有你所要找的书!<br><br>请过一段时间再来看看。</p>"
end if
else Response.Write "错误调用!"
end if
%>
</td>
</tr>
<tr>
<td height="45" align="center">
<!--#include file="include/foot.inc"-->
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -