Home  >  Article  >  Web Front-end  >  JS实现的一个简单的Autocomplete自动完成例子_javascript技巧

JS实现的一个简单的Autocomplete自动完成例子_javascript技巧

WBOY
WBOYOriginal
2016-05-16 16:52:151568browse

分享一篇无意间发现的自动完成源码。这里测试的时候使用的是数组,实际使用的时候,我们换成Ajax从服务器端获取的方式就OK了。

提示:可以直接保存到一个html文件中查看效果。

复制代码 代码如下:






自动完成函数(Autocomplete Function)


   

   

<script><BR> var autoComplete=new AutoComplete('o','auto',['b0','b12','b22','b3','b4','b5','b6','b7','b8','b2','abd','ab','acd','accd','b1','cd','ccd','cbcv','cxf']);<BR></script>



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn