| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 632 人关注过本帖
标题:高手帮我看一下我这个程序怎么?
取消只看楼主 加入收藏
gjw5299
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2007-10-17
收藏
 问题点数:0 回复次数:1 
高手帮我看一下我这个程序怎么?
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>新闻搜索</title>
<!--#include file="conn.asp"-->
<%
dim keyword,which,rs,sql
keyword=request("keyword")
which=request("r1")
if keyword="" then
 response.Write("<script language='javascript'>alert('请输入搜索条件');history.go(-1);</script>")
end if
if which="" then
response.Write("<script language='javascript'>alert('参数错误');history.go(-1);</script>")
end if
select case which
  case "biaoti"
   sql="select * from Article where deleted=1 and Title like '%"&keyword&"%'"
  case "neirong"
   sql="select * from Article where deleted=1 and Content like '%"&keyword&"%'"
  case "zuozhe"
   sql="select * from Article where deleted=1 and Editor like '%"&keyword&"%'"
  case "soft"
   sql="select * from Soft where deleted=1 and SoftName like '%"&keyword&"%'"
  end select
  %>
</head>

<body>

<table width="778" border="1" style="border-collapse:collapse; border-color:#9999CC;" align="center">
    <tr>
      <td width="90%" height="20" align="center" bgcolor="#cde4f0"><div align="left">当前位置>>新闻搜索>>新闻关键字<font color=""#FF0000"">[<%=request("KeyWord")%>]</font></div></td>
    </tr>
</table>
<%
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
if rs.bof and rs.eof then
response.write("<tr><td><div align=""center"">没有搜索到关键字为"&keyword&"的文章请<a href=""javascript:history.back();"">返回</a>重新搜索</font></div></td></tr>")
response.End()
end if
response.Write("<table width=""778"" border=""1"" style=""border-collapse:collapse; border-color:#9999CC;"" align=""center""><tr><td width=""40%"">新闻标题</td><td width=""10%"">作者</td><td width=""20%"">出处</td><td width=""10%"">点击次数</td><td width=""20%"">添加时间</td></tr>")
 dim tatalrecord,tatalpages,nowpage
    rs.pagesize=20
    tatalrecord=rs.recordcount
    tatalpages=rs.pagecount
    if not isempty(request("page")) then
       nowPage=cint(request("page"))
    else
        nowPage=1
    end if
    rs.absolutepage=nowpage
    n=1
    do while not rs.eof and n<=rs.pagesize       
%>
<tr><td><a href="../<%=rs("url")%>" target="_blank"><%=rs("Title")%></a></td><td><%=rs("Author")%></td><td><%=rs("editor")%></td><td><%=rs("Hits")%></td><td><%=rs("UpdateTime")%></td></tr>
<%       
       n=n+1
     rs.movenext
     loop
   rs.close
    set rs=nothing   
%>
</table>
<table align="center" width="778" height="30" border="0" cellpadding="1" cellspacing="0" bordercolor="#EAEAEA" style="border-collapse:collapse; ">
        <tr>
          <td align="right" style="font-size:12px; color:#0066FF;"><%if nowpage<>1 then%>
            <a href="Article_search.asp?page=<%=1%>">首页</a>
            <%else%>
            首页
            <%end if%>
            <%if nowpage>1 then%>
            <a href="Article_search.asp?page=<%=nowpage-1%>">上一页</a>
            <%else%>
            上一页
            <%end if%>
            <%if nowpage < tatalpages then%>
            <a href="Article_search.asp?page=<%=nowpage+1%>">下一页</a>
            <%else%>
            下一页
            <%end if%>
            <%if nowpage<>tatalpages then %>
            <a href="Article_search.asp?page=<%=tatalpages%>">尾页</a>
            <%else%>
            尾页
            <%end if%>
            &nbsp;<%=nowpage%>/<%=tatalpages%>页&nbsp;
            <select name="sel_page" onChange="javascript:location=this.options[this.selectedIndex].value;">
              <%for k=1 to tatalpages%>
              <%if k=nowpage then %>
              <option value="Article_search.asp?page=<%=k%>" selected="selected">第<%=k%>页</option>
              <%else%>
              <option value="Article_search.asp?page=<%=k%>">第<%=k%>页</option>
              <%end if%>
              <%next%>
              </select>
              &nbsp;共<font color="#812F2F"><%=tatalrecord%></font>篇文章</td>
        </tr>
      </table>
</body>
</html>
问题~可能是出在分页上面,当点下一页的时候会出提示框“请输入搜索条件”
高手帮我看一下下,谢了
2007-12-25 15:38
gjw5299
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2007-10-17
收藏
得分:0 
还有什么好办法吗?
2007-12-26 10:04
快速回复:高手帮我看一下我这个程序怎么?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.023557 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved