asp+ajax仿google搜索提示效果代码(5)


}
}
if(li_num!=-1){
value_ed=obj_input.value=obj_div.firstChild.childNodes[li_num].childNodes[1].nodeValue;
}else{
value_ed=obj_input.value=value_ing;
}
setlistyle();
}

后台ajax.asp
复制代码 代码如下:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001" %>
<%option explicit%>
<%Response.CodePage="65001"%>
<%Response.Charset="utf-8" %>
<!--#include file="conn.asp"-->
<%
dim Sift_value
dim Sql,Rs,I,Num
dim Contant
Contant=""
Num=10
Sift_value=replace(unescape(request.form("sift_value")),"""","""""")
Sql="select top "&Num&" keyword,matchnum from search where keyword like """&Sift_value&"%"" order by id"
set Rs=server.CreateObject("adodb.recordset")
Rs.open Sql,Conn,1,1
if not (Rs.eof and Rs.bof) then
for I=0 to Num-1
Contant=Contant&"'"&rs(0)&","&rs(1)&"'"
Rs.movenext
if Rs.eof then exit for
next
end if
response.Write(Contant)
Rs.close
set Rs=nothing
%>