Ajax suggest is similar to Google's search prompt.

Source: Internet
Author: User
Tags javascript array

Implementation:
<SCRIPT type = "text/JavaScript" src = "/path/to/suggestframework. js"> </SCRIPT>
<SCRIPT type = "text/JavaScript"> window. onload = initializesuggestframework; </SCRIPT>
With the above two sentences, each text box with a name will have five more attributes:
1. Action is required. Accept the data submitted in get mode, and return the dynamic page of the related Javascript array.
2. If capture returns more than one column (such as the words and Chinese meanings in this example), it will replace the column entered by the user (starting from 1 ). This usually corresponds to the database field.
Optional. The default value is 1.
3. Columns drop-down lists the number of columns. For example, in this example, you can query words by letter and display the Chinese meaning on the right. Optional. The default value is 1.
4. Delay query latency, in milliseconds. Low latency can produce faster responses, but will increase the burden on the server. Optional; 1000 (1 second) by default ).
5. If heading is set to true, the first array value will be used as an optional item (title bar ). It is useful when there are two or more columns of data. Optional. The default value is false.
Only two data items are required for data submission.
1. Name of the type input box
2. Q search keywords (default UTF-8 encoding)
The compressed package you downloaded already contains PHP and ColdFusion examples. Of course, this framework applies to all Programming Language , No platform restrictions. The background data output is a javascript statement. Write a one-dimensional array as follows:
New array ("val1", "val2", "val3 ″);
Write the two-dimensional array as follows:
New array (
New array ("1st rows, 1st Columns", "1st rows, 2nd Columns "),
New array ("2nd rows, 1st Columns", "1st rows, 2nd Columns "),
New array ("3rd rows, 1st Columns", "1st rows, 2nd Columns ")
);
Finally, we will introduce the four classes to be defined in CSS.
. Suggestframework_list indicates the region where the content is located.
. Suggestframework_heading first prompt
. Suggestframework_highlighted
. Suggestframework_normal other prompts
Http://xiazai.jb51.net/200903/yuanma/SuggestFramework-0.31.zip
Related Article

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.