欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Jquery模仿Baidu、Google搜索時自動補充搜索結(jié)果提示

 更新時間:2013年12月26日 17:01:30   作者:  
昨天研究了一下Jquery 模仿Baidu、Google收索時自動補充收索結(jié)果的提示,感覺效果還行,下面與大家分享下代碼
好程序就是懶人喜歡的程序。好程序員就是懶人程序員。昨天研究了一下Jquery 模仿Baidu、Google搜索時自動補充搜索結(jié)果的提示,感覺效果還行。特意和大家分享一下。所需Jquery插件。請看代碼:
復(fù)制代碼 代碼如下:

<script type="text/javascript">
$().ready( function () {

$(":text").result(auto);

function auto(data){
$("#keyWord").val(data.name);
}

$("#keyWord").autocomplete(obj, {//obj是數(shù)據(jù)對象數(shù)組Json
minChars: 0, //表示在自動完成激活之前填入的最小字符
max: 5, //表示列表里的條目數(shù)
autoFill: true, //表示自動填充
mustMatch: false, //表示必須匹配條目,文本框里輸入的內(nèi)容,必須是data參數(shù)里的數(shù)據(jù),如果不匹配,文本框就被清空
matchContains: true, //表示包含匹配,相當(dāng)于模糊匹配
scrollHeight: 200, //表示列表顯示高度,默認(rèn)高度為180

formatItem: function (row) {
return row.name;
},
formatMatch: function (row) {
return row.name;
},
formatResult: function (row) {
return row.value;
}
});
});
</script>

jsp:
復(fù)制代碼 代碼如下:

<div>
<h4> 模仿BaiDu,google搜索提示功能</h4>
<table>
<tr><td>名稱:<input type="text" id="keyWord" /></td></tr>
</table>
</div>

相關(guān)文章

最新評論