asp搜索代码的问题处在哪里

来源:百度知道 编辑:UC知道 时间:2024/06/06 13:30:40
这是一个搜索页面,只要一登录就提示“搜索关键字不能为空”,有可能是哪里的问题 怎么解决
<!--#include file="mdb.asp"-->
<!--#Include File="Check_hx.asp"-->
<!--#include file="inc/config.asp"-->
<!--#include file="inc/format.asp"-->
<!--#include file="inc/inc.asp"-->
<%
dim keyWord,SearchType
keyWord = checkspace(trim(request.QueryString("keyWord")))
SearchType = checkspace(trim(request.QueryString("SearchType")))
if keyWord="" then
Response.Write "<script>alert('搜索关键字不能为空');window.close();</script>"
Response.End
end if
If Len(keyWord)>8 Then
Response.Write "<script>alert('搜索关键字超出系统限定<8个字符范围');window.close();</script>"
Response.End
end if
if request("page")<>"" then
if not isInteger(request("page")) then
Response.W

不知道你是从其它页面提交过来的还是本页提交给本页,如果是本页提交给本页,那么,你第一次登陆时keyWord肯定为空,所以要在判断keyWord前先判断一下是否是搜索,最好再设一个参数action,用action=search表示搜索,当action=search时再判断keyWord,如为空就不判断