JS Control AutoComplete 0.11 demo and download January 5 updated _javascript Tips

Source: Internet
Author: User
January 5 Updated

Fix AutoComplete text box Focus shift, automatically complete a bug that the container cannot disappear
Add Expandallitem method, double click can appear all item, please see the example
Add the Customstyle example, which demonstrates how to embellish the AutoComplete control with CSS, see autocomplete_custom CSS File

Demo and Download:
http://www.never-online.net/code/neverModules/autocomplete/

Features improvements and features over the previous version:
1. Increase the speed of matching.
2. Add IgnoreCase property (when False, the case is case-sensitive, the default is True)
3. When you add the Ignorewhere property (true, the matching result uses greedy matching, that is, as long as there is an input character in the entire string, the datasource content is fed into the matching result)
4. Press ESC to return.
5. Compatible IE6.0, Opera9.0, Mozilla Firefox1.5
6. You can manually empty datasource data, or assign values dynamically to datasource. Easy to do Ajax, see examples in detail.
7. Highlighted property (default is True, the recommended setting is false when large amounts of data are measured).
8. In IE, making up the div is obscured by the select control. Take a look at the first example in detail.
9. Direction key support.

Ideas and references:

When I initialize, I generate the DataSource string ("") at once for all of the data (the HTML I used in the string literal is as short as possible so that it can generate the data with the fewest strings) and then match it with a regular. It feels like it's going to be fast.

Although the range feature has not yet been added, the basics are sufficient. It's an ideal speed. A speed problem now is that if you want to make the most of the efficiency of the kernel in Opera,mozilla,ie, the result is that the code may be significantly longer. After all, the efficiency between the different cores is a big difference.

Compatibility and efficiency are also contradictory issues. Using insertadjancehtml This method is one of the simple compatibility methods for inserting a string in a large number of cases.

Another is to add highlight to the problem, after using the join, to highlight, you must backtrack again, which is equivalent to a two times match. This is also one of the problems of efficiency. Therefore, it is recommended that the highlighted property be set to False in the case of large data volumes. This efficiency in theory, should be able to increase the speed of about 40%.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.