Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

auto complete box

Posted on 2005-04-18
5
Medium Priority
?
309 Views
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.
Thanks,
Michael
0
Comment
Question by:mhoggatt1
  • 2
  • 2
5 Comments
 
LVL 25

Assisted Solution

by:archrajan
archrajan earned 800 total points
ID: 13808394
check this:
http://webfx.eae.net/dhtml/combobox/combo_demo.htm

for help with ur code we need to see ur code

0
 
LVL 13

Expert Comment

by:davidlars99
ID: 13808554
you mean something like this..?

http://www.frozendev.com/temp/dropdownposition.htm
0
 

Author Comment

by:mhoggatt1
ID: 13809058
Sorry guys, I forgot to paste the code -

<HTML>
<HEAD>
      <TITLE>JavaScript Toolbox - Auto-Complete</TITLE>
<SCRIPT LANGUAGE="JavaScript" SRC="compact/js_ac.php"></SCRIPT>
</HEAD>
<BODY BGCOLOR=#000000 LINK="#00615F" VLINK="#00615F" ALINK="#00615F">
<BR>
<U><B>Example:</B></U>
<BR>

<FORM>

<B>Auto-Complete</B><BR>
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"
onChange="this.form.input1.value=this.options[this.selectedIndex].value">
      <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
</SELECT>

</FORM>

</BODY>
</HTML>

0
 
LVL 13

Accepted Solution

by:
davidlars99 earned 1200 total points
ID: 13809089
you don't need to post your code I already did it for you  :)

http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_21393048.html#13808554

is this what you are after


<html>
<head>
<script language=javascript>

var items;

function init(){
      items=document.getElementById('all_items');
}

function position(txtOb){
      for(var i=0;i<items.length;i++)
            if(items[i].text.substring(0,txtOb.value.length).toLowerCase()==txtOb.value.toLowerCase())
                  items.selectedIndex=i                  
      return true
}
</script>
</head>
<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
</select>
</body>
</html>

0
 

Author Comment

by:mhoggatt1
ID: 13809680
Thanks very much for the code, it's really appreciated. I'll add/split points !
Michael
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article discusses how to create an extensible mechanism for linked drop downs.
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…
Suggested Courses

564 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