search.asp

来自「一个在线销售读书的简单网站 可以用来学习一下 功能不是很健全」· ASP 代码 · 共 53 行

ASP
53
字号
<%@LANGUAGE="VBSCRIPT"%>
<%option explicit%>
<% dim conn,rs,sql,i,connstr,temp
connstr="dbq=" & server.MapPath("mdb/bookshop.mdb") & ";driver= {microsoft access driver (*.mdb)};"
set conn=server.CreateObject("adodb.connection")
conn.open connstr
set rs=server.CreateObject("adodb.recordset")
temp=request.form("class2")
if temp="" then  response.redirect "book.asp"
set rs=conn.execute("select * from book where class='" & request.form("class2") & "'")
if rs.bof then
response.write "no record"
response.end
end if
%>
<html>
<head>
<script>
function openwin(id){window.open("shopcart.asp?mode=add & itemno="+ id,"","height=250,width=450,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=yes,location=no");}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><style type="text/css">
<!--
body {
	background-color: #86BF78;
}
-->
</style></head>

<body><center>
<table width="800" border="1" align="center" bordercolor="#C479C8" bgcolor="#B4D3B7">
<tr>
<td width="100%" colspan="2" align="center">新书查询</td>
</tr>
<%do while not(rs.eof or err)%>
<tr>
<td width="88%"><%if rs("photo")<>"" then response.write "<img align='left' src='" & rs("photo")&"'>"%><br>
<%=rs("book")%><br><%=rs("author")%><br><%=rs("price")%><br><%=rs("memo")%>
</td>
<td width="12%"><% response.write "<a href='javascript:openwin("+cstr(rs(0))+")'>购买</a>"%></td>
</tr>
<%rs.movenext 
loop%>
<tr>
<td width="100%" height="6" colspan="2"></td>
</tr>
<tr>
<td width="100%" colspan="2" align="center"><a href="bookright.asp">返回</a></td>
</tr>
</table></center>
</body>
</html>

⌨️ 快捷键说明

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