ASP+AJAX做类似google的搜索提示(2)_ASP教程
教程Tag:暂无Tag,欢迎添加,赚取U币!
推荐:如何用Asp取得数据库中所有表名和字段名% set rs=server.CreateObject(adodb.recordset) db= db.mdb '只要直接更改数据库名称就能够看到效果了。 set conn=server.CreateObject(adodb.connection) connstr=Provider=Microsoft.Jet.OLEDB.4.0;Data Source= Server.MapPath(db) conn.open c
return xmlhttp;
}
function change_key()
{
if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
{
var str = document.getElementById("txt_key").value;
xmlHttp.open("get","search.asp?key=" + str ,true);
xmlHttp.onreadystatechange = handSearchRequest;
xmlHttp.send(null);
}
}
function handSearchRequest()
{
if (xmlHttp.readyState == 4)
{
var div = document.getElementById("search_suggest");
div.innerHTML = "";
var str = xmlHttp.responseText.split("|");
for (var i=0; i<str.length; i++)
{
var suggest = ’<div onmouseover="javascript:suggestOver(this);" ’;
suggest += ’onmouseout="javascript:suggestOut(this);" ’;
suggest += ’onclick="javascript:setSearch(this.innerHTML);" ’;
suggest += ’class="suggest_link">’ + str[i] + ’</div>’;
div.innerHTML += suggest;
}
}
}
function setSearch(div_value)
{
document.getElementById("txt_key").value = div_value;
document.getElementById("search_suggest").className = ’none’;
}
function suggestOver(div_value)
{
div_value.className = ’suggest_link_over’;
}
function suggestOut(div_value)
{
div_value.className = ’suggest_link’;
}
[/code]
分享:Asp读取文本文件并显示html head http-equiv=Content-Type content=text/html; charset=gb2312 title/title /head body % LANGUAGE = VBScript % % Const ForReading = 1, ForWriting = 2, ForAppending = 8 Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse
相关ASP教程:
- 相关链接:
- 教程说明:
ASP教程-ASP+AJAX做类似google的搜索提示(2)。