Aim: When the user t开发者_C百科ypes a word in a text box then all the words starting with that word should be populated and we can select one of them.
Here are the best implementations I have come across...
- AutoComplete from phpguru.org
- WICK AutoComplete
- Script.aculo.us Autocompleter
- BComplete Autosuggest Script
- Autocompletition from Wiseguysonly
- Autocomplete Control from Momche
- AutoSuggest from Brand Spanking New
- Ajax dynamic list
- AutoSuggest from Gadgetopia
- XMLHttpRequest Autocomplete
- Capxous Framework
How-To (no code included)
Implement an Event Handler on the text box to listen for a value changed event.
In the Event Handler, make an AJAX call to the server (assuming you have a web service that will return the results) with the partial word.
Parse the results returned from the AJAX call and place them in a DIV just below the text box, allowing the user to select the correct one.
Show the results DIV.
These are the theoretical steps behind implement that style of text box - without knowing more about your particular setup, it'd be hard to give more advice. It would be best if you posted some of your own code.
Do you mean autocomplete?
http://www.javascript-examples.com/autocomplete-demo/
I think he was talking about incremental search, as in search as your type ala Google. You'll want to put some controls in place depending on your data set and anticipated number of users. For instance if you're expecting a lot of traffic you probably won't want to pull on every key press, maybe add a delay to wait for them to finish typing.
Here's an example using php, Mysql, and Jquery from W3: http://www.w3schools.com/php/php_ajax_livesearch.asp
精彩评论