⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 search.asp

📁 Active Server Pages 网页制作教程看之前请传到ASP空间。或者本地用iis。或安装pws内有说明
💻 ASP
字号:
<%
Response.Buffer = True

MySelf = Request.ServerVariables( "PATH_INFO" )
Page = CLng(Request( "Page" ))
Path = Request( "Path" )
Keyword = Request( "Keyword" )
MaxRecords = CLng( Request( "MaxRecords" ) )

If Page <= 0 Then Page = 1
If Keyword = Empty Then Keyword = "王国荣"
If MaxRecords <= 0 Then MaxRecords = 50

Param = "&Keyword=" & Server.HTMLEncode(Keyword)
Param = Param & "&Path=" & Server.HTMLEncode(Path)
Param = Param & "&MaxRecords=" & MaxRecords
%>

<HTML>
<BODY bgcolor="#FFFFFF" Background="../B01.jpg">
<H2>Index Server 搜索引擎<HR></H2>

<FORM Action=<%=Myself%> METHOD=GET>
    关键字:
<INPUT Type=Text Name=Keyword Value="<%=Keyword%>"><BR>
    路  径:
<INPUT Type=Text Name=Path Value="<%=Path%>">(可省略)<BR>
最大文件数:
<INPUT Type=Text Name=MaxRecords Value="<%=MaxRecords%>"><BR>
            <!-- 左边是5个全角的空格 -->
<INPUT Type=Submit Name=Send Value=" 搜 索 ">
</FORM>

<%
If Request("Send") <> Empty Or Request("Page") <> Empty Then
   set Q = Server.CreateObject("ixsso.Query")
   If Path <> Empty Then 
      set U = Server.CreateObject("ixsso.Util")
      U.AddScopeToQuery Q, Path, "deep"
   End If
   Q.Query = Keyword
   Q.SortBy = "rank[d]"
   Q.Columns = "DocTitle,Characterization,Rank,VPath,Write,Size"
   Q.MaxRecords = MaxRecords
   set rs = Q.CreateRecordSet("nonsequential")
%>
<HR>
<BLOCKQUOTE>
<%
  rs.PageSize = 5
  If Page < 1 Then Page = 1
  If Page > rs.PageCount Then Page = rs.PageCount

  If Page <= 0 Then
     Msg = "搜索结果:没有找到任何符合条件的文件!" 
     Msg = Server.HTMLEncode( Msg )
     Response.Clear
     Response.Redirect Myself & "?Msg=" & Msg & Param
  End If

  rs.AbsolutePage = Page
  For iPage = 1 To rs.PageSize
     RecNo = (Page - 1) * rs.PageSize + iPage
%>
  <B><%=RecNo & ". "%><%=rs("DocTitle")%></B><BR>
  <B>摘要:</B><%=rs("Characterization")%><BR>
  <B>网址:</B><A HREF=<%=rs("vPath")%>><%=rs("vPath")%></A><BR>
  <B>时间: </B><%=rs("Write")%><BR>
  <B>大小: </B><%=rs("Size")%><P>

<%   
     rs.MoveNext
     If rs.EOF Then Exit For
  Next
%>
</TABLE>
</BLOCKQUOTE>
<DIV ALIGN=right>
<FORM Action=<%=Myself%> Method=GET>
<HR>
<%If Page <> 1 Then ' 如果不是位于第一页 %>
  <A HREF=<%=Myself%>?Page=1<%=Param%>>第一页</A>  
  <A HREF=<%=Myself%>?Page=<%=(Page-1)%><%=Param%>>上一页</A>  
<%End If
If Page <> rs.PageCount Then ' 如果不是位于最后一页
%>
  <A HREF=<%=Myself%>?Page=<%=(Page+1)%><%=Param%>>下一页</A>  
  <A HREF=<%=Myself%>?Page=<%=rs.PageCount%><%=Param%>>最后一页</A>  
<%End If%>

输入页号:<INPUT TYPE=TEXT Name=Page SIZE=3>
页号:<FONT COLOR="Red"><%=Page%>/<%=rs.PageCount%></FONT>
</FORM>
</P></DIV>
<%End If%>

<%If Request("Msg") <> Empty Then %>
<HR><FONT Color=Red><%=Request("Msg")%></FONT>
<%End If%>
</BODY>
</HTML>




⌨️ 快捷键说明

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