ASP+AJAX做類似google的搜索提示_ASP教程
教程Tag:暫無(wú)Tag,歡迎添加,賺取U幣!
推薦:如何用Asp取得數(shù)據(jù)庫(kù)中所有表名和字段名% set rs=server.CreateObject(adodb.recordset) db= db.mdb '只要直接更改數(shù)據(jù)庫(kù)名稱就能夠看到效果了。 set conn=server.CreateObject(adodb.connection) connstr=Provider=Microsoft.Jet.OLEDB.4.0;Data Source= Server.MapPath(db) conn.open c
主要要文件有:Index.html 實(shí)現(xiàn)功能,一個(gè)文本框,輸入內(nèi)容并實(shí)現(xiàn)提示
search.asp 查詢功能,讓文本框輸入的內(nèi)容在數(shù)據(jù)庫(kù)中查詢,然后返回給客戶端
conn.asp 數(shù)據(jù)庫(kù)連接功能,實(shí)現(xiàn)與數(shù)據(jù)庫(kù)相連
xmlhttp.js AJAX 核心部分,用來(lái)把客戶端的數(shù)據(jù)傳給服務(wù)端,再把服務(wù)端的數(shù)據(jù)返還給客戶端.
style.css 樣式文件,主要是對(duì)google提示框查詢到的內(nèi)容進(jìn)行樣式化處理
先看第一個(gè)文件style.css
[code=css]
@charset "utf-8";
/* CSS Document */
body
{
font-size:12px;
font-family:Arial, Helvetica, sans-serif;
}
#search_suggest
{
position:absolute;
background:#FFFFFF;
text-align:left;
border:1px #000000 solid;
}
.suggest_link_over
{
background-color:#e8f2fe;
padding:2px 6px;
}
.suggest_link
{
padding:2px 6px;
background-color:#FFFFFF;
}
.none
{
display:none;
}
[/code]
第二個(gè)文件: xmlhttp.js
[code=jscript]
// JavaScript Documentrt
var xmlHttp = createXmlHttpRequest();
function createXmlHttpRequest()
{
var xmlhttp = null;
try
{
xmlhttp = XMLHttpRequest();
}
catch(e1)
{
try
{
xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
}
catch(e2)
{
try
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e3)
{
xmlhttp = false;
alert("創(chuàng)建失敗!");
}
}
}
分享: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
相關(guān)ASP教程:
- asp FSO 讀寫(xiě)文件本文件實(shí)現(xiàn)代碼
- asp中isNull、isEmpty和空字符串的區(qū)別
- asp獲取用戶真實(shí)IP地址的方法
- asp連接sqlserver數(shù)據(jù)庫(kù)實(shí)現(xiàn)代碼
- asp中正則表達(dá)式過(guò)濾html代碼函數(shù)
- asp中g(shù)et post提交表單區(qū)別
- 網(wǎng)頁(yè)模板:ASP內(nèi)建對(duì)象Request
- xmlhttp的open方法使用詳解
- ASP的常用的自定義函數(shù)大全
- asp中用for循環(huán)的一個(gè)小技巧
- eWebEditor v3.8 列目錄
- ASP無(wú)組件分頁(yè)實(shí)現(xiàn)思路及代碼
- 相關(guān)鏈接:
- 教程說(shuō)明:
ASP教程-ASP+AJAX做類似google的搜索提示
。