www.gusucode.com > asp+SQLServer网上书店系统设计(源代码+论文) > asp+SQLServer网上书店系统设计(源代码+论文)\网上书店asp+SQLServer\网上书店\admin\reserchbook.asp
<% if session("admin")="" then Response.redirect "backlogin.asp?msg=对不起你还没有登录,请先登录!" end if %> <html> <head> <title>书籍审查</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <STYLE type=text/css>.main { FONT-SIZE: 12px } .main1 { FONT-SIZE: 14px } .main2 { FONT-SIZE: 16px } .main3 { FONT-SIZE: 7px } .main4 { FONT-SIZE: 10px } A:link { COLOR: #ffffff; TEXT-DECORATION: none } A:visited { COLOR: #ffffff; TEXT-DECORATION: none } A:active { COLOR: #ff0000; TEXT-DECORATION: none } A:hover { COLOR: #aa0000; TEXT-DECORATION: underline } </STYLE> <script language="javascript"> function confirmdel(id,page){ if (confirm("真的要删除这种书名?")) window.location.href="del_book.asp?id="+id+"&page="+page } </script> </head> <body text="#000000" bgcolor="#e6e4f1"> <br> <form name="form2" method="post" action="reserchbook.asp" target="main"> <tr><font size=3>书籍查找 </font><input size=10 name="bookname"> <select name='method' size='1' tabindex='0' class='a' style="font-size: 14px"> <option value='1'>书名</option> <option value='2'>作者</option> </select> <INPUT type=submit size=3 value=查找 name=Submit2 style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; FONT-SIZE: 12px; BORDER-LEFT: black 1px solid; BORDER-BOTTOM: black 1px solid; BACKGROUND-COLOR: #bbcc33"> </tr> </form> <div align="center"> <center> <!--#include file="conn.asp"--> <% method=Trim(Request("method")) set rs=server.createobject("adodb.recordset") bookname=Trim(Request("bookname")) sqltext="select * from book " if method=1 then sqltext=sqltext &" where book_name like '%"& bookname&"%' " else sqltext=sqltext &" where author like '%"& bookname&"%' " end if rs.open sqltext,cn,1,1 dim MaxPerPage MaxPerPage=10 '假如没有数据时 If rs.eof and rs.bof then call showpages response.write "<p align='center'><font color='#ff0000'>书库里没有此书</font></p>" response.end End if '取得页数,并判断用户输入的是否数字类型的数据,如不是将以第一页显示 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 call showpages call list If Rs.recordcount > MaxPerPage then call showpages end if '显示帖子的子程序 Sub list()%> <table cellspacing=1 cellpadding=4 width=100% bgcolor=#000000> <tbody> <tr valign=top bgcolor=#BECFF1> <td class=main1 width="662" height="10" bgcolor="#8CAAE7"></td> </tr> <tr valign=top bgcolor=#BECFF1> <td class=main1 width="662" height="18">以下是查找结果--</td> </tr> <tr valign=top bgcolor=#BECFF1> <td class=main1 width="662" height="15"> <table border="1" cellpadding="0" cellspacing="0" width="100%" bordercolorlight="#BECFF1" bordercolordark="#BECFF1"> <tr class=main1 bgcolor="#8CAAE7"> <td width="9%" height="35" align="center">编号</td> <td width="21%" height="35" align="center">书名</td> <td width="14%" height="35" align="center">大类</td> <td width="13%" height="35" align="center">小类</td> <td width="13%" height="35" align="center">会员价</td> <td width="12%" height="35" align="center">市场价</td> <td width="9%" height="35" align="center">操作</td> <td width="9%" height="35" align="center">操作</td> </tr> <% if not rs.eof then i=0 do while not rs.eof %> <tr class=main1 bgcolor="#8CAAE7"> <td width="9%" align="center"><%=rs("ID")%></td> <td width="21%" align="center"><%=rs("book_Name")%></td> <td width="14%" align="center"><%=rs("book_sort1")%></td> <td width="13%" align="center"><%=rs("book_sort2")%></td> <td width="13%" align="center"><%=rs("book_price2")%></td> <td width="12%" align="center"><%=rs("book_price1")%></td> <td width="9%" align="center"> <%response.write "<a href='book_modify.asp?ID="&rs("ID")&"&page="&CurrentPage&"' ><font color=#0000FF>编辑</font></a>" %> </td> <td width="9%" align="center"> <%response.write "<a href='javascript:confirmdel(" & rs("ID") & ","& CurrentPage&")'><font color=#0000FF>删除</font></a>" %> </td> </tr> <% i=i+1 if i >= MaxPerpage then exit do rs.movenext loop end if %> </table> </td> </tr> <tr bgcolor=#BECFF1> <td class=main1 width="662" height="28" bgcolor="#BECFF1"> <p> </td> </tr> <tr bgcolor=#BECFF1> <td class=main1 width="662" height="4" bgcolor="#8CAAE7"></td> </tr> </tbody> </table> <br> <% End sub rs.close conn.close %> </center> </div> <div align="center"> <center> <% '显示翻页的子程序 sub showpages()%> <table border="0" cellPadding="0" cellSpacing="0" width="100%" bgColor="#8CAAE7" > <tr><td width="695"> <% response.write "<form method=Post action='reserchbook.asp'>" %> <input type=hidden name="method" value="<%=method%>"> <input type=hidden name="bookname" value="<%=bookname%>"> <table border="0" cellPadding="0" cellSpacing="0" width="100%" height="30"> <tr> <td class=main1> <font color="#000000"> <p align="center"> <% Response.write "<font color='#000000'>分页-</font>" If currentpage > 1 Then response.write "<a href='reserchbook.asp?&page="+cstr(1)+"&method="+method+"&bookname="+bookname+"'><font color='#000000'>首页</font></a><font color='#ffffff'><b>-</b></font>" Response.write "<a href='reserchbook.asp?page="+Cstr(currentpage-1)+"&method="+method+"&bookname="+bookname+"'><font color='#000000'>前页</font></a><font color='#ffffff'><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='reserchbook.asp?page="+Cstr(currentPage+1)+"&method="+method+"&bookname="+bookname+"'><font color='#000000'>后页</font></a><font color='#ffffff'><b>-</b></font>" Response.write "<a href='reserchbook.asp?page="+Cstr(Rs.PageCount)+"&method="+method+"&bookname="+bookname+"'><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' class=main1>转到:</font><input type='text' name='page' size=4 maxlength=4 class=smallInput value="&Currentpage&"> " response.write "<input class=buttonface type='submit' value='Go' name='cndok' style='background-color: #BECFF1'></span> " %> </font> </td> </tr> </table> </center> </td></tr> </table> </form> <%end sub%> </body> </html>