auto complete box

Posted on 2005-04-18
Last Modified: 2008-02-01
I received a link from the PHP experts to the code below. I am trying to modify it to work with my PHP code. It is an auto complete box with a text box beside it. When a name is typed it comes up in the dropdown menu. When I tried to execute the code it wouldn't change the dropdown menu.
Question by:mhoggatt1
    LVL 25

    Assisted Solution

    check this:

    for help with ur code we need to see ur code

    LVL 13

    Expert Comment

    you mean something like this..?

    Author Comment

    Sorry guys, I forgot to paste the code -

          <TITLE>JavaScript Toolbox - Auto-Complete</TITLE>
    <SCRIPT LANGUAGE="JavaScript" SRC="compact/js_ac.php"></SCRIPT>
    <BODY BGCOLOR=#000000 LINK="#00615F" VLINK="#00615F" ALINK="#00615F">


    Start typing a name in the input box that matches a name in the drop-down...<BR>
    <INPUT TYPE="text" NAME="input1" VALUE="" ONKEYUP="autoComplete(this,this.form.options,'value',true)">
    <SELECT NAME="options"
          <OPTION VALUE="adam">adam
          <OPTION VALUE="george">george
          <OPTION VALUE="matt">matt
          <OPTION VALUE="bill">bill
          <OPTION VALUE="greg">greg
          <OPTION VALUE="bob">bob
          <OPTION VALUE="david">david
          <OPTION VALUE="ryan">ryan



    LVL 13

    Accepted Solution

    you don't need to post your code I already did it for you  :)

    is this what you are after

    <script language=javascript>

    var items;

    function init(){

    function position(txtOb){
          for(var i=0;i<items.length;i++)
          return true
    <body onload="setTimeout('init()', 10)">
    <input type="text" name="txtKeyword" id="idKeyword" value="" onkeyup="position(this)" />
    <select name="all_items" id="all_items">
          <option Value="" selected>Choose a State
          <option Value="AL">Alabama
          <option Value="AK">Alaska
          <option Value="MD">Maryland
          <option Value="NJ">New Jersey
          <option Value="NM">New Mexico
          <option Value="NY">New York
          <option Value="NC">North Carolina
          <option Value="ND">North Dakota
          <option Value="OH">Ohio
          <option Value="PA">Pennsylvania
          <option Value="RI">Rhode Island
          <option Value="SC">South Carolina
          <option Value="VT">Vermont
          <option Value="VA">Virginia
          <option Value="WA">Washington


    Author Comment

    Thanks very much for the code, it's really appreciated. I'll add/split points !

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    In my daily work (mainly using, I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
    JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now