jquery php Baidu search box Smart Tips effect

Source: Internet
Author: User

This program is the use of php+ajax+jquery implementation of a imitation Baidu smart hints, the need for friends to download test Oh.


Code such as the following

index.html file, Save as Index.htm


<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">php file

<?php  Header (' Content-type:text/html;charset=utf-8 '); mysql_connect (' localhost ', ' root ', ');  mysql_select_db ("test");   mysql_query ("Set names UTF8"); $queryString = $_post[' queryString ');  if (strlen ($queryString) >0) {  $sql = "Select value from countries WHERE value is like '". $queryString. " % ' LIMIT ten ';  $query = mysql_query ($sql);  while ($result = Mysql_fetch_array ($query, Mysql_both)) {        $value = $result [' value '];   ? > <li onclick= "Fill (' <?= $value?> ')" ><?

= $value?></li> <?php} }


Sql.sql Copy This here and save it to yourDatabase Tutorials
CREATE TABLE IF not EXISTS ' countries ' (' ID ' int (6) is not NULL auto_increment, ' value ' varchar (+) ' NOT null default ' ', PRIMARY KEY (' id ')) engine=myisam DEFAULT Charset=utf8 auto_increment=243;----Dump the data in the table ' countries '--insert into ' countr IES ' (' id ', ' value ') VALUES (1, ' Afghanistan '), (2, ' Aringland Islands '), (3, ' Albania '), (4, ' Algeria '), (5, ' American Samoa '), (6, ' Andorra '), (7, ' Angola '), (8, ' Anguilla '), (9, ' Antarctica '), (ten, ' Antigua and Barbuda '), (one, ' Argentina '), ( ("Armenia"), (+, ' Aruba '), (+, ' Australia '), (+, ' Austria '), (+, ' Azerbaijan '), (+, ' Bahamas '), (+, ' Bahrain '), (19 , ' Bangladesh '), (+, ' Barbados '), (+, ' Belarus '), (+, ' Belgium '), (+, ' Belize '), (+, ' Benin '), (+, ' Bermuda '), (26, ' Bhutan '), (+, ' Bolivia '), (+, ' Bosnia and Herzegovina '), (+, ' Botswana '), (+, ' Bouvet '), (+, ' Brazil '), (32, ' British Indian Ocean Territory '), (+, ' Brunei Darussalam '), (+, ' Bulgaria '), (+, ' Burkina Faso '), (+, ' Burundi '), (37, ' (Cambodia '), (Cameroon, ' Canada '), (+, ' Cape V '), (Erde '), (Cayman, ' Islands '), ((a), ' Central African Republic '), (+, ' Chad '), (+, ' Chile '), ((a), ' China '), (the "Christmas Island '), (Cocos (Keeling) Islands '), (+, ' Colombia '), (+, ' Comoros '), (+, ' Congo '), (Wuyi, ' Congo '), (*, ' democratic '), Republic '), (Islands, ' Cook '), (SI, ' Costa Rica '), (as in, ' Ivory Coast (Ivory Coast) '), (+, ' Croatia (Hrvatska) '), (+), ' Cub A '), (Cyprus, ' Czech Republic '), ((a), ' Denmark '), (+, ' Djibouti '), (+, ' Dominica '), (+ "Dominican"), , (+, ' East Timor '), (Ecuador, ' the ' Egypt '), (the "70, ' El Salvador '), (" (), ' Equatorial Guinea '), (the "(), ' Eritrea '), (the" (), "(A)," (A), "(a)," Estonia '), (Ethiopia, ' Falkland Islands '), ("The (), ' Faroe-Islands '), (the" (a), ' Fiji '), (the "(a), ' Finland '), (A, ' France '), (French Guiana '), (+, ' French Polynesia '), (+, ' French Southern Territories '), (+, ' Gabon '), (Bayi, ' Gambia '), (82, ' Georgia '), (Germany, ' Ghana '), (+ (), ' Gibraltar '), (+, ' Greece '), (the "(), ' the ' Greenland '), (the" (), "(89), ' Grenada '), ( Guadeloupe '), (Guam, ' Guatemala '), (A, ' GuinEA '), (the "Guinea-Bissau"), (94, ' Guyana '), ("Heard, ' Haiti '), (" McDonald "), (" The "), (" A "), (the" Islands, "), (in a. Kong '), ("Hungary"), (+, ' Iceland '), (101, ' India '), (102, ' Indonesia '), (103, ' Iran '), (104, ' Iraq '), (a. ), (106, ' Israel '), (107, ' Italy '), (108, ' Jamaica '), (109, ' Japan '), ((a), ' Jordan '), (111, ' Kazakhstan '), (in A, ' Kenya '), ( 113, ' Kiribati '), (Korea, ' Korea (South) '), ("Kuwait", "117"), ("("), "(a)", "(a), (Kyrgyzstan, ' 118 ') Democratic Republic '), (119, ' Latvia '), (+, ' Lebanon '), (121, ' Lesotho '), (122, ' Liberia '), 123, ' Libyan Arab Jamahiriya '), (124, ' Liechtenstein '), ("Lithuania"), (126, ' Luxembourg '), (127, ' Macao '), (+, ' Macedonia '), (129, ' Madagascar '), ("Malawi"), (131, ' Malaysia '), (the "Maldives", "133"), (the []), (Mali, ' 134 '), Malta, ' 135 ' Islands '), (136, ' Martinique '), (137, ' Mauritania '), (138, ' Mauritius '), (139, ' Mayotte '), (141, ' Mexico '), Micronesia '), (142, ' Moldova '), (143, ' Monaco '), (144, ' Mongolia '), (145, ' Montserrat '),(146, ' Morocco '), (147, ' Mozambique '), (148, ' Myanmar '), (149, ' Namibia '), (, ' Nauru '), (151, ' Nepal '), (152, ' Netherlands '), (153, ' Netherlands Antilles '), (154, ' New Caledonia '), (155, ' new Zealand '), (156, ' Nicaragua '), (157, ' Niger '), (158, ' Nigeria '), (159, ' Niue '), ("Norfolk, ' 161 Island ')," (A, A (), ' Northern ' Mariana '), (Islands, ' 162 '), (163, ' Oman '), (164, ' Pakistan '), (165, ' Palau '), (166, ' Palestinian Territories '), (167, ' Panama '), (168, ' Papua New Guinea '), ( 169, ' Paraguay '), ("Peru"), (171, ' Philippines '), (172, ' Pitcairn '), (173, ' Poland '), (174, ' Portugal '), (175, ' Puerto '), Rico '), (176, ' Qatar '), (177, ' Runion '), (178, ' Romania '), (179, ' Russian Federation '), (the "Rwanda, ' 181 '), (a. Helena '), (182, ' Saint Kitts and Nevis '), (183, ' Saint Lucia '), (184, ' Saint Pierre and Miquelon '), (185, ' Saint Vincent and T He Grenadines '), (186, ' Samoa '), (187, ' San Marino '), (188, ' Sao Tome and Principe '), (189, ' Saudi Arabia '), ((), ' Senegal '), (191, ' Serbia and Montenegro '), (192, ' Seychelles '), (193, ' Sierra LeonE '), (194, ' Singapore '), (195, ' Slovakia '), (196, ' Slovenia '), (197, ' Solomon Islands '), (198, ' Somalia '), (199, ' South Africa '), (Georgia, ' South "and the South Sandwich Islands '), (201, ' Spain '), (202, ' Sri Lanka '), (203, ' Sudan '), (204, ' Sur Iname '), (205, ' Svalbard and Jan Mayen Islands '), (206, ' Swaziland '), (207, ' Sweden '), (208, ' Switzerland '), (209, ' Syria '), ("Taiwan"), (211, ' Tajikistan '), (212, ' Tanzania '), (213, ' Thailand '), (214, ' Togo '), (215, ' Tokelau '), (216, ' Tonga ') , (217, ' Trinidad and Tobago '), (218, ' Tunisia '), (219, ' Turkey '), (+, ' Turkmenistan '), (221, ' Turks and Caicos Islands '), ( 222, ' Tuvalu '), (223, ' Uganda '), (224, ' Ukraine '), (225, ' "Arab Emirates '), (226, ' the ' Kingdom '), (227, ' the '" States of America '), (228, ' Uruguay '), (229, ' Uzbekistan '), (the Vanuatu, ' 231 '), (of the, ' Vatican City '), (232, ' Venezuela '), ( 233, ' Vietnam '), (234, ' Virgin Islands (British) '), (235, ' Virgin Islands (US) '), (236, ' Wallis and Futuna Islands '), (237, ' W Estern Sahara '), (238, ' Yemen '), (239, ' Zaire '), (+, ' ZAmbia '), (241, ' Zimbabwe '); 


Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.

jquery php Baidu search box Smart Tips effect

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.