回 帖 发 新 帖 刷新版面

主题:关于搜索结果页面问题,寻求帮助!

请各位大大有空帮小弟(菜鸟)看看这个search.asp错在哪里,为什么我分标题、内容、作者分别搜索只有按作者搜索显示出的页面,里面的分页都可以打开,搜索出来的文章数目也不少显示多少个结果就都能找到;而按标题或内容搜索显示出的页面,首个分页显示正常,点2或者后面的分页就没有内容了,“没有找到您要的信息!”而且分页的页数也由原来的几个变成只有一个搜索结果空白页面,有时候换个关键字按标题或者内容搜索,刚搜出来显示出的页面为100多,点一下后面的分页就变成只有几十个分页了。拜托各位大大帮小弟看看,因为找不出是哪里出的问题,所以我把整页都放上来了。

回复列表 (共4个回复)

沙发

整页代码如下

<!--#include file = conn.asp-->
<HTML>
<HEAD>
<TITLE>信息检索系统</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<STYLE TYPE="text/css">
BODY { FONT-SIZE: 12px; COLOR: #000000; font-family: "宋体"} 
DIV { FONT-SIZE: 12px; 
COLOR: #333333 } 
select { FONT-SIZE: 12px;} 
TD { FONT-SIZE: 12px; COLOR: #333333 ; font-family: "宋体"} 
A:link 
{ COLOR: #3366CC; TEXT-DECORATION: none ; font-family: "宋体"} 
A:visited { COLOR: 
#3366cc; TEXT-DECORATION: none }
A:active { COLOR: #6699ff; TEXT-DECORATION: none 

A:hover { COLOR: #FF4400; TEXT-DECORATION: none } 
.kbhide { DISPLAY: none } 

#floater { Z-INDEX: -1; LEFT: 0px; VISIBILITY: visible; WIDTH: 5px; POSITION: 
absolute; TOP: 0px }
.sfont { LINE-HEIGHT: 20px } .greenb { FONT-WEIGHT: bold; 
COLOR: #308080 } 
.title 
{ font-size: 14.8px; font-weight: bold ; line-height: 144%; color: #009933} 
.pt9 
{ FONT-SIZE: 12px } .tch { color: #FF0000} 
.article { font-size: 14.8px; line-height: 
150%} 
.underline { text-decoration: underline} 
.spanclass { VISIBILITY: hidden;width: 760px;height:1px;POSITION: absolute; left:1px;top:1px}
a.p1 { color: #000000} 
a.p1:visited 
{ color: #000000} 
a.p1:hover { color: #FF4400}
a.p1:active { color: #FF6600} 
.dh 
{ font-size: 12px; color: #eeeeee; font-family: "宋体"; line-height: 19px} 
.bodyright 
{ BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #FFDDA2 1px solid} 
.bodyleft 
{ BORDER-LEFT: #FFDDA2 1px solid; BORDER-RIGHT: #000000 1px solid} 
.leftbottom 
{ BORDER-BOTTOM: #FFDDA2 1px solid; BORDER-LEFT: #FFDDA2 1px solid}
.leftbottom1
{ BORDER-TOP: #FFDDA2 1px solid; BORDER-LEFT: #FFDDA2 1px solid}
.topbottom 
{ BORDER-BOTTOM: #FFDDA2 1px solid; BORDER-TOP: #000000 1px solid }
.topbottom1
{ BORDER-TOP: #FFDDA2 1px solid;}
.rightbottom 
{ BORDER-BOTTOM: #FFDDA2 1px solid; BORDER-RIGHT: #FFDDA2 1px solid}
.rightbottom1
{ BORDER-TOP: #FFDDA2 1px solid; BORDER-RIGHT: #FFDDA2 1px solid}
.bottom { 
BORDER-BOTTOM: #444444 1px solid}
.allborder { BORDER-BOTTOM: #dddddd 1px solid;BORDER-TOP: 
#dddddd 1px solid;BORDER-LEFT: #dddddd 1px solid; BORDER-RIGHT: #dddddd 1px solid 
}
<!--
.btd { font-size: 14.8px}
-->
</STYLE>
<%
  function CovtTitle(content)
  if content<>"" then
    CovtTitle=content
 CovtTitle=replace(CovtTitle,"[粗]","<b>")
 if instr(1,CovtTitle,"<b>",1)<>0 then CovtTitle=CovtTitle+"</b>"
 CovtTitle=replace(CovtTitle,"[红]","<font color=red>")
 if instr(1,CovtTitle,"<font color=red>",1)<>0 then CovtTitle=CovtTitle+"</font>"
 CovtTitle=replace(CovtTitle,"[蓝]","<font color=blue>")
 if instr(1,CovtTitle,"<font color=blue>",1)<>0 then CovtTitle=CovtTitle+"</font>"
 CovtTitle=replace(CovtTitle,"[绿]","<font color=green>")
 if instr(1,CovtTitle,"<font color=green>",1)<>0 then CovtTitle=CovtTitle+"</font>"
 CovtTitle=replace(CovtTitle,"[建议]","<font color=red>[建议]</font>")
 CovtTitle=replace(CovtTitle,"[注意]","<font color=red>[注意]</font>")
 CovtTitle=replace(CovtTitle,"[下载]","<font color=red>[下载]</font>")
 CovtTitle=replace(CovtTitle,"[公告]","<font color=red>[公告]</font>")
 CovtTitle=replace(CovtTitle,"[转载]","<font color=red>[转载]</font>")
 CovtTitle=replace(CovtTitle,"[焦点]","<font color=red>[焦点]</font>")
 CovtTitle=replace(CovtTitle,"[推荐]","<font color=red>[推荐]</font>")
 CovtTitle=replace(CovtTitle,"[原创]","<font color=red>[原创]</font>")
  end if
  End function

startime=timer()
keyword=request("keyword")
condition=request("condition")
oldkeyword=request("oldkeyword")
queryinlast=request("queryinlast")
sKeyWord=split(keyword," ")
keyword=""
for ikey=0 to ubound(skeyword)
  if ikey=0 then
    KeyWord=sKeyWord(ikey)
  else
    KeyWord=keyword&"%"&sKeyWord(ikey)
  end if
next
KeyWord=replace(KeyWord," ","")
page=request("page")
curpage=request("curpage")
if page<=1 or page="" then page=1
if curpage<=1 or curpage="" then curpage=1
set rs = server.createobject("adodb.recordset")
if queryinlast="1" then
  sql = "select * from news where content like '%"&oldkeyword&"%"&keyword&"%' order by Date DESC"
else
  if condition="title" then
    sql = "select * from news where title like '%"&keyword&"%' order by Date DESC"
  else
    if  condition="content" then
    sql = "select * from news where content like '%"&keyword&"%' order by Date DESC"
    else
       sql = "select * from news where Author like '%"&keyword&"%' order by Date DESC"
    end if
  end if
end if

rs.open sql,conn,1,1
keyword=replace(keyword,"%"," ")
if queryinlast="1" then keyword=oldkeyword&" "&keyword
rs.pagesize=10
for i=1 to rs.pagesize*(page-1)
  if not rs.eof then rs.movenext
next

function CovertKeyword(Content)
  CovertKeyword=Content
  if CovertKeyword<>"" then    
    CovertKeyword=replace(CovertKeyword,"<BR>","",1,-1,1)
    CovertKeyword=replace(CovertKeyword,"<","&lt")
 CovertKeyword=replace(CovertKeyword,">","&gt")
 CovertKeyword=replace(CovertKeyword,Keyword,"<font style=color:red;background-color:>"&Keyword&"</font>")
  end if
end function
Function AllPath()
  Domain=Request.ServerVariables("SERVER_NAME")
  gFilePath=Request.ServerVariables("PATH_INFO")
  gFilePath=lcase(left(gFilePath,instrRev(gFilePath,"/")))
  CountN=len(gFilePath)
  gFilePath=lcase(left(gFilePath,CountN-1))
  AllPath="http://"&Domain&gfilepath
End Function
AllCount=rs.recordcount
%>

板凳


<BODY leftmargin="0" topmargin="5" marginwidth="0" marginheight="0">
<table width="750" border="0" cellspacing="0" cellpadding="0" bgcolor="#000000" align="center">
  <tr> 
    
    <td align="center" valign="top" WIDTH="755"> 
      <table width="743" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
        <tr> 
          <td>           
            <table width="743" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" style="border-top:#000000 1px solid">
              <tr> 
                <td> 
                  <table width="743" border="0" cellspacing="1" cellpadding="0" bgcolor="#FFFFFF" align="center">
        <form action='' method=get>
          <tr> 
            <td bgcolor="#ffffff">            
              <div align="center"> 
                <table width="100%" border="0" cellspacing="5" cellpadding="0">
                  <tr> 
                    <td height="35" colspan="2"> 
                      <div align="center"> 
                        <TABLE ALIGN=center BACKGROUND="images/frame_E7F7FF.gif" BORDER=0 CELLPADDING=0 CELLSPACING=0 HEIGHT=31 WIDTH=550>
                         <TR> 
                           <TD ALIGN=middle HEIGHT=26 VALIGN=center WIDTH=290> 
                             <INPUT NAME='keyword' SIZE=35 VALUE='<%=keyword%>' MAXLENGTH="128">
        <INPUT type='hidden' NAME='oldkeyword' SIZE=35 VALUE='<%=keyword%>' MAXLENGTH="128">
                           </TD>
                           <TD WIDTH=133 HEIGHT=26 valign="center"> 
                             <INPUT ALIGN=middle BORDER=0 cache HEIGHT=19 SRC="images/search_E7F7FF.gif" TYPE=image VALUE=submit WIDTH=47 ALT="检索" NAME="image">
                             <a href=''><img ALIGN=middle src='images/zuhe.gif' border=0></a>
                           </TD>
                           <TD HEIGHT=26 WIDTH=127> <FONT SIZE=2> 
                             <INPUT NAME=queryinlast TYPE=checkbox VALUE=1>
                             在结果中检索</FONT>
         </TD>
                          </TR>
                          </TABLE>
                        </div> 
                    </td>
                  </tr>
                </table>
              </div>
            </td>
          </tr>
        </form>
      </table>
   </td>
      </tr>
<%
if not rs.eof then
endtime=timer()
%>
      <tr> 
       <td height="20" bgcolor="#f0f9ff"> 
         <div align="center"><font color=#0000ff ><span class="p1"><span class="p1">
   <span class="p1">本次检索</span></span></span></font><span class="p1">
   <span class="p1"><span class="p2">为您找到 
         <font color='#ff0000'><%=AllCount%></font> 篇有关的页面, <%response.write "页面执行时间:"&FormatNumber((endtime-startime)*1000,3)&"毫秒"%>.</span></span></span></div>
       </td>
      </tr>

3 楼


 <tr valign="middle"> 
         <td height="35"> 
           <div align="center">
     <span class="p1">页数:
<%
  if rs.pagecount>10 and  curpage>1 then 
    response.write("<a href=search.asp?curpage="&curpage-1&"&Page="&Page-1&"&keyword="&keyword&">[<<]</a> "&vbcrlf)
  end if
  for x=1+((curpage-1)*10) to curpage*10
    if x>rs.pagecount then exit for
    if ccur(page)=x then
   response.write("<font color='red'>["&x&"] </font>"&vbcrlf)
 else
   response.write("<a href=search.asp?curpage="&curpage&"&Page="&x&"&keyword="&keyword&">["&x&"]</a> "&vbcrlf)
 end if 
  next
  if rs.pagecount>10 and  x<rs.pagecount then 
    response.write("<a href=search.asp?curpage="&curpage+1&"&Page="&Page+1&"&keyword="&keyword&">[>>]</a> "&vbcrlf)
  end if
%>
           </span>
     </div>
                </td>
              </tr>
<%end if%>
            </table>
          </td>
        </tr>
        <tr> 
          <td>
            <table width="743" border="0" cellspacing="0" cellpadding="0">
<%
if not rs.eof then
for i=1 to rs.pagesize
if rs.eof then exit for
%>
         <tr> 
            <td height="20">
    <table width="742" border="0" cellspacing="0" cellpadding="0">
      <tr bgcolor="#f0f9ff">
        <td width="10" class="p1">·</td>
        <td width="20" class="p1">
          <div align="center"><%=i+(rs.pagesize*(page-1))%>.</div>
        </td>
        <td width="695">
  <span class="p2">
  <a href="<%=rs("BigClassEN")%>/<%=rs("SmallClassEN")%>/<%=left(rs("FileName"),6)%>/<%=rs("FileName")%>.htm" target=_blank><%=CovtTitle(CovertKeyword(rs("Title")))%> </a><span class="p1">(<%=rs("date")%>) </span>[<a href="<%=rs("BigClassEN")%>/<%=rs("SmallClassEN")%>/<%=rs("SmallClassEN")%>1.htm" target=_blank><%=rs("SmallClassCN")%></a>]
        </td>
        <td width="20"> </td>
      </tr>
      <tr>
        <td width="10"></td>
        <td width="20"></td>
        <td width="695" class="p1" style=LINE-HEIGHT:16px>
  <%=trim(CovertKeyword(left(rs("Content"),100)))%>...<br>
                        <strong>链接:</strong><font color="#666666"><%=AllPath%>/<%=rs("BigClassEN")%>/<%=rs("SmallClassEN")%>/<%=left(rs("FileName"),6)%>/<%=rs("FileName")%>.htm 
                        </font> </td>
        <td width="20"> </td>
      </tr>
      <tr bgcolor="#FFFFFF">
        <td height="20" bgcolor="#FFFFFF" COLSPAN="4"></td>
      </tr>
    </table>
    </td>
   </tr>
<%
rs.movenext
next
else
%>
<tr>
<td align='center' height="150">没有找到您要的信息!</td>
</tr>
<%
end if
%>

   </table>
          </td>
        </tr>
      </table>

4 楼


 <table width="743" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
   <%if AllCount>0 then%>
        <tr> 
          <td height="20"> 
            <div align="center">
   <span class="p1">页数:
<%
  if rs.pagecount>10 and  curpage>1 then 
    response.write("<a href=search.asp?curpage="&curpage-1&"&Page="&Page-1&"&keyword="&keyword&">[<<]</a> "&vbcrlf)
  end if
  for x=1+((curpage-1)*10) to curpage*10
    if x>rs.pagecount then exit for
    if ccur(page)=x then
   response.write("<font color='red'>["&x&"] </font>"&vbcrlf)
 else
   response.write("<a href=search.asp?curpage="&curpage&"&Page="&x&"&keyword="&keyword&">["&x&"]</a> "&vbcrlf)
 end if 
  next
  if rs.pagecount>10 and  x<rs.pagecount then 
    response.write("<a href=search.asp?curpage="&curpage+1&"&Page="&Page+1&"&keyword="&keyword&">[>>]</a> "&vbcrlf)
  end if
%>
            </span> 
            </div>
          </td>
        </tr>
  <%end if%>
        <tr> 
          <td height="40">
        <table width="743" border="0" cellspacing="1" cellpadding="0"  align="center">
        <form action='' method=get>
          <tr> 
            <td  height="35"> 
              <div align="center">
              <div align="center"> 
              <table width="550" border="0" cellspacing="0" cellpadding="0" height="31" background="images/frame_E7F7FF.gif" align="center">
               <TR> 
                 <TD ALIGN=middle HEIGHT=26 VALIGN=center WIDTH=290> 
                   <INPUT NAME='keyword' SIZE=35 VALUE='<%=keyword%>' MAXLENGTH="128">
       <INPUT type='hidden' NAME='oldkeyword' SIZE=35 VALUE='<%=keyword%>' MAXLENGTH="128">
                 </TD>
                 <TD WIDTH=133 HEIGHT=26 valign="center"> 
                   <INPUT ALIGN=middle BORDER=0 cache HEIGHT=19 SRC="images/search_E7F7FF.gif" TYPE=image VALUE=submit WIDTH=47 ALT="检索" NAME="image">
                   <a href=''><img ALIGN=middle src='images/zuhe.gif' border=0></a>
                 </TD>
                 <TD HEIGHT=26 WIDTH=127> <FONT SIZE=2> 
                   <INPUT NAME=queryinlast TYPE=checkbox VALUE=1>
                   在结果中检索</FONT>
     </TD>
               </TR>
              </table>
   </div>
            </td>
          </tr>
        </form>
      </table>
     </td>
     </tr>   
    </table>      
    </td>
    
  </tr>
</table>
<table width="750" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#000000">
    <tr> 
      <td height="1"></td>
    </tr>
  </table>

我来回复

您尚未登录,请登录后再回复。点此登录或注册