自動完成功能

2021-09-05 20:11:11 字數 641 閱讀 9416

先放個吧!這是最終的效果!

下面具體**:

index.php

把需要的js**庫包含進來

keywords here

new capxous.autocomplete("keyword", function() );

這裡是具體呼叫的**

auto.php

<?php

header('content-type:text/html;charset=gb2312');

header("cache-control: no-cache, must-revalidate");

include('conn.inc.php');

$conn = getconn();

$keyword = trim($_get['keyword']);

$sql = "select * from channel where keywords like '".$keyword."%' limit 0,10";

$result = query($sql,$conn);

if(nums($result))

}?>

從資料庫

取出的資料需要轉換一下編碼!不然中文會出現亂碼!

具體的演示可以登入

自動完成功能

先放個吧!這是最終的效果!下面具體 index.php 把需要的js 庫包含進來 keywords here new capxous.autocomplete keyword function 這裡是具體呼叫的 auto.php header content type text html chars...

自動完成功能 asp ajax

目錄頁 伺服器端 response.charset gb2312 gjz request.querystring gjz gjz replace gjz,str1 狐狸,白狐,銀狐,水貂,獺兔,貉子,白貉,烏蘇里貉,美國水貂,白兔,鳥,養殖,技術,魚,海魚,淡水魚 str2 split str1,s...

Ajax自動完成功能

近日學習了一下ajax,照做了幾個例子,感覺比較新奇。第乙個就是自動完成的功能即autocomplete,具體的例子可以在這裡看 http www.b2c battery.co.uk 在search框內輸入乙個產品型號,就可以看見效果了。這裡用到了乙個開源的 autoassist 有興趣的可以看一下...