回 帖 发 新 帖 刷新版面

主题:[讨论]请问一个关于查询没有结果后自动跳转的问题~!

我自己写了一个查询的页面,但是有一个问题就是,如果我没有查询到数据,就5秒后自动跳转,如果有数据的话就自动显示。但是现在就算我有查询到数据到自动跳转,请问怎样修改啊??谢谢·!其中一些代码如下:
<%@ language=VBScript%>
<meta http-equiv="refresh" content="5; url=javascript:window.history.go(-1);">
<% 




sql="select * from list where [title] like '%"& Request.form("A1")&"%' or [word] like '%"& Request.form("A1")&"%' order by title" 
          rs.open sql,conn,1,3
  If RS.RecordCount<=0 Then
  response.write "<br><br><center><table border=1 cellpadding=20 bordercolor=black bgcolor=#EEEEEE width=450>" 
  response.write "<tr><td style='font:9pt Verdana'>" 
  response.write "对不起,没有找到相关数据!"
  response.write "5秒后自动调整上一页!" 
能不能在"If RS.RecordCount<=0 Then"这里经行修改啊?谢谢~! 

回复列表 (共2个回复)

沙发

<%@ language=VBScript%>
<% 
sql="select * from list where [title] like '%"& Request.form("A1")&"%' or [word] like '%"& Request.form("A1")&"%' order by title" 
          rs.open sql,conn,1,3
  If RS.RecordCount<=0 Then   %>
<meta http-equiv="refresh" content="5; url=javascript:window.history.go(-1);">
<%
  response.write "<br><br><center><table border=1 cellpadding=20 bordercolor=black bgcolor=#EEEEEE width=450>" 
  response.write "<tr><td style='font:9pt Verdana'>" 
  response.write "对不起,没有找到相关数据!"
  response.write "5秒后自动调整上一页!"

板凳

我同意1楼的说法.
也可以这样,在查询页面,没有查到内容,就弹出一个对话框,显示"没有查到,点击返回",代码这样写:
<%response.write "<script language=javascript>alert('没有查到,点击返回');history.back(-1);</script>"%>

我来回复

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