query_lb.old.asp

来自「书店的管理系统。不错的一个源程序。提供给大家。」· ASP 代码 · 共 301 行

ASP
301
字号
<!--#include File="adovbs.inc"-->
<html>

<head>
<title>图书查询</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function form2_onsubmit(theForm) {
  if (theForm.number.value == "")
  {
    alert("请输入 \"购买册数\" .");
    theForm.number.focus();
    return (false);
  }

  if ( (theForm.number.value > 1000)||(theForm.number.value < 1) )
  {
    alert("请重新输入 \"购买册数\" .");
    theForm.number.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.number.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    if (ch != ",")
      allNum += ch;
  }
  if (!allValid)
  {
    alert("请重新输入 \"购买册数\" .");
    theForm.number.focus();
    return (false);
  }
return (true)
}

function b_go_onclick(theForm,maxPage) {
  if (theForm.GotoPageNo.value == "")
  {
    alert("请输入 \"要转到的页数\" .");
    theForm.GotoPageNo.focus();
    return (false);
  }

  if ( (theForm.GotoPageNo.value > maxPage)||(theForm.GotoPageNo.value < 1) )
  {
    alert("请重新输入 \"要转到的页数\" .");
    theForm.GotoPageNo.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.GotoPageNo.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    if (ch != ",")
      allNum += ch;
  }
  if (!allValid)
  {
    alert("请重新输入 \"要转到的页数\" .");
    theForm.GotoPageNo.focus();
    return (false);
  }
return (true)
}

//-->
</SCRIPT>
</head>

<%
lb=Request("lb")
Mv = Request.form("Mv")
PageNo = Request.form("PageNo")
GotoPageNo = CInt(Request.form("GotoPageNo"))
%>

<body topmargin="5" vlink="#0000FF" alink="#FF0000" link="#0000FF">

<div align="center"><center></center></div>


<p align="center"><img src="../images/ball.gif" WIDTH="14" HEIGHT="14"> 
<strong><big><%=lb%></big></strong> 
<img src="../images/ball.gif" WIDTH="14" HEIGHT="14"></p>

<p></p>

<%
set con=server.createobject("ADODB.Connection")
con.open Application("str_con")

set res=server.createobject("ADODB.Recordset")
set res.ActiveConnection = con
'res.source="select title_id,title_name,author,pub_date,pic_id,price,pub_name,hits,flag_new,flag_pre from title_info,publisher_info where left(lib_category_id,1)='"&cat&"' and title_info.pub_id=publisher_info.pub_id ORDER BY pic_id + pdf_path DESC, pic_id DESC, pdf_path DESC"
res.source="select XHBID,丛书名,正书名,副书名,责任者,其他责任者,出版日期,出版者,FMZPID,定价,flag_new,flag_pre,hits,折扣,备注 from bookW where 类别 = '"&lb&"'"


res.pagesize=10
res.cursorlocation=3
res.open ,,adOpenStatic

PageCount = res.PageCount

if res.eof=true then
	response.write "没有满足条件的图书 !"
else
	If PageNo = "" Then
		PageNo = 1
	End If

	Select Case Mv
		Case "首页"
			PageNo = 1

		Case "上一页"
			If PageNo > 1 Then
	       		PageNo = PageNo - 1
			Else
				PageNo = 1
			End If

		 Case "下一页"
			If res.AbsolutePage < PageCount Then
				PageNo = PageNo + 1
			Else
				PageNo = PageCount
			End If

		Case "尾页"
			PageNo = PageCount

		Case "go!"
			PageNo = GotoPageNo

	    Case  Else
			PageNo = 1
	End Select
	
	res.AbsolutePage = PageNo
%>

	<div align="center"><center>

   <form Action="query_lb.asp" Method="POST" name="form4">
	  <input type="hidden" name="lb" value="<%=lb%>">
      <input type="hidden" name="PageNo" value="<%=PageNo%>">

	  <input TYPE="submit" Name="Mv" Value="首页" style="font-size: 9pt" <%If PageNo = 1 Then %>disabled<%End If %>> 
 
	  <input TYPE="submit" Name="Mv" Value="上一页" style="font-size: 9pt" <%If PageNo <= 1 Then %>disabled<%End If %>> 
 
	  <input TYPE="submit" Name="Mv" Value="下一页" style="font-size: 9pt" <%If PageNo >= PageCount Then %>disabled<%End If %>>

	  <input TYPE="submit" Name="Mv" Value="尾页" style="font-size: 9pt" <%If PageNo = PageCount Then %>disabled<%End If %>> 

	  &nbsp;&nbsp;&nbsp;&nbsp;
	  转到第<input name="GotoPageNo" size="4" value="<%=GotoPageNo%>">页
	  <input TYPE="submit" Name="Mv" Value="go!" style="font-size: 9pt" id=b_go LANGUAGE=javascript onclick="return b_go_onclick(form4,<%=PageCount%>)"> 


	  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;第<%=PageNo%>页;共<%=PageCount%>页;共<%=res.recordcount%>条书目

   </form>


	<table border="0" width="75%" style="font-size: 9pt" align="center">

<% For j = 1 to res.PageSize %>

<%
	book_name=""
	if not isNull(res("丛书名")) then
		book_name="<b>"+res("丛书名")+":</b>"
	end if
	if not isNull(res("正书名")) then
		book_name=book_name+res("正书名")
	end if
	if not isNull(res("副书名")) then
		book_name=book_name+" -  "+res("副书名")
	end if
%>	

     <tr align="left">
         <td bgcolor="#e8e8ec"><a Href="title_detail.asp?XHBID=<%=res("XHBID")%>&amp;book_name=<%=book_name%>"><%=book_name%></a>
         &nbsp;&nbsp;&nbsp;<%if res("flag_new")="1" then%><img src="new.jpg" alt="new" WIDTH="22" HEIGHT="13"><%end if%>
         &nbsp;&nbsp;&nbsp;<%if res("flag_pre")="1" then%><img src="pre.jpg" alt="new" WIDTH="22" HEIGHT="13"><%end if%>
         </td>
     </tr>


     <tr align="left">
		<td bgcolor="#e8e8ec" align="left">

		价格:<FONT color=tomato><%=res("定价")%></FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

		折扣:<FONT color=tomato><%=res("折扣")%></FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

		备注:<FONT color=tomato><%=res("备注")%></FONT>

		</td>
     </tr>

     
     <tr align="left">
		<td bgcolor="#e8e8ec" align="left"><%=res("出版者")%>
		&nbsp;&nbsp;&nbsp;出版日期:<%=res("出版日期")%>
		&nbsp;&nbsp;&nbsp;点击数:<%=res("hits")%></td>
     </tr>

     <tr align="left">
		<td bgcolor="#e8e8ec" align="ledt">
		<form Action="gwc.asp" Method="POST" name="form2" LANGUAGE=javascript onsubmit="return form2_onsubmit(this)">
			<input type="hidden" name="ShopID" value="<%=Application("ZDID")%>">
			<input type="hidden" name="XHBID" value="<%=res("XHBID")%>">
			<input type="hidden" name="flag" value="new1">
			<input type="text" name="number" value="1" maxlength=3 size=3>册
			<input type="submit" name="b1" value="放进购物车" style="font-size: 9pt">
		</form>

		</td>
     </tr>

     <tr align="left">
     </tr>

<%
	 res.movenext
	 If res.EOF Then
		Exit For
	 End If
   Next 
%>
   </table>
   

   <form Action="query_lb.asp" Method="POST" name="form3">
	  <input type="hidden" name="lb" value="<%=lb%>">
      <input type="hidden" name="PageNo" value="<%=PageNo%>">

	  <input TYPE="submit" Name="Mv" Value="首页" style="font-size: 9pt" <%If PageNo = 1 Then %>disabled<%End If %>> 
 
	  <input TYPE="submit" Name="Mv" Value="上一页" style="font-size: 9pt" <%If PageNo <= 1 Then %>disabled<%End If %>> 
 
	  <input TYPE="submit" Name="Mv" Value="下一页" style="font-size: 9pt" <%If PageNo >= PageCount Then %>disabled<%End If %>>

	  <input TYPE="submit" Name="Mv" Value="尾页" style="font-size: 9pt" <%If PageNo = PageCount Then %>disabled<%End If %>> 

	  &nbsp;&nbsp;&nbsp;&nbsp;
	  转到第<input name="GotoPageNo" size="4" value="<%=GotoPageNo%>">页
	  <input TYPE="submit" Name="Mv" Value="go!" style="font-size: 9pt" id=b_go LANGUAGE=javascript onclick="return b_go_onclick(form3,<%=PageCount%>)"> 


	  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;第<%=PageNo%>页;共<%=PageCount%>页;共<%=res.recordcount%>条书目

   </form>
   </center></div>

<%
end if  '"没有满足条件的图书 !"

res.close 
set res=nothing
con.Close
%>



      
</body>
</html>

⌨️ 快捷键说明

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