473,394 Members | 1,481 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

how to select autocompleter values through keyboard and mouse?

My requirement is i need to develop autocomplete textbox with
MobileNumbers.while i enter number with the help of "onkeyup" it will invoke the controller and display all the mobilenumbers displayed below the textbox.

how can i select those numbers with the help of mouse and with the help of keyboard also.....


can any one help me please . mail me: [EDIT]
Oct 11 '10 #1
2 1250
acoder
16,027 Expert Mod 8TB
It depends how your autocomplete controller/display is set up. Post your code or an example, and some details of what you've tried so far.
Oct 13 '10 #2
text box is look like this

Expand|Select|Wrap|Line Numbers
  1. <input type="text" name="mobile" value="" id="txtphno"  onkeyup="doCompletion();" class="selectbox" maxlength="10" autocomplete="off">

and script code is

Expand|Select|Wrap|Line Numbers
  1. function initRequest() {
  2.  
  3. if (window.XMLHttpRequest) {
  4.         xmlhttp=new XMLHttpRequest();
  5.         return xmlhttp;
  6.     } else if (window.ActiveXObject) {
  7.         isIE = true;
  8.         return new ActiveXObject("Microsoft.XMLHTTP");
  9.     }
  10.  
  11. }
  12.  
  13. function doCompletion() {
  14.  
  15.     var txtphnum =document.getElementById("txtphno").value;
  16.     outp=document.getElementById("mobNumbers");
  17.  
  18.     if (txtphnum == "") {
  19.        // alert(txtphnum.length);
  20.         document.getElementById("mobileNumberDiv").style.visibility = "hidden";
  21.  
  22.         return false;
  23.     } else if(txtphnum.length<=0 ){
  24.  
  25.         return false;
  26.     }else{
  27.  
  28.         var url = "customer.htm?action=getMobileNumbers&id=" + 
  29.                 escape(txtphnum);
  30.         var xmlhttp = initRequest();
  31.         xmlhttp.onreadystatechange = function() {
  32.  
  33.            var result=xmlhttp.responseText;
  34.            result=result.trim();
  35.  
  36.             if (xmlhttp.readyState == 4) {
  37.                 //document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
  38.  
  39.                 if (xmlhttp.status == 200) {
  40.                        setPhoneAutoComplete(result);
  41.                     //setPhoneAutoComplete(xmlhttp.responseText);
  42.                 } else if (xmlhttp.status == 204){
  43.  
  44.                 }
  45.             }
  46.         };
  47.         xmlhttp.open("GET", url, true);
  48.         xmlhttp.send(null);
  49.     }
  50.  
  51.  
  52. }
  53.  
  54. function  setPhoneAutoComplete( phoneNumbers){
  55.  
  56.     mob=phoneNumbers.toString().split(" ");
  57.     document.getElementById("mobileNumberDiv").style.display = "block";
  58.      document.getElementById("mobNumbers").value ="";
  59.       for(var i=0;i<mob.length;i++){
  60.            document.getElementById("mobNumbers").value +=mob[i]+'\n';
  61.     // document.getElementById("mobNumbers").innerHTML +='& # 1 3;'+mob[i];
  62.  
  63.        }
  64.  
  65.     outp.onmouseover = mouseHandler;
  66.     outp.onmouseout = mouseHandlerOut;
  67.     outp.onclick = mouseClick;
  68.  
  69. }
how can i write a functionality for mouseclick and keyboard events
Oct 13 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Peter | last post by:
Hello, Im looking for some source in c++ which allows me to block keyboard and mouse for win98 reg, Thanks
2
by: DC Gringo | last post by:
I have two listboxes, the first of which is an autopostback=true that allows multiple row selection. When I select multiple values (by holding down CTL) in the first one, it should query the...
25
by: Romanise | last post by:
An LCD monitor with keyboard and mouse capabilities on it, thinnest possible, to hang on rack-door can be a boon for expensive spaces of datawarehouses. Has anyone come across one? Maybe...
2
by: Ryan Liu | last post by:
Hi, In a windows application, What are the APIs to use to detect if the user has not using keyboard or mouse for a while(idle)? And what is the API to know the user just used either one (out of...
0
by: J de Boyne Pollard | last post by:
sint *f(int x) s{ s return(&x); /* this address points to storage local of f() */ s} s> ssuch a returned pointer is ... invalid, RPFalse, not in agreement. The pointer is valid. A...
5
by: sarayu | last post by:
Hi All, How can i select multiple values in a form without using options.I want to select more than one image from a table and submit those selected values as a request to the next page.I don't...
13
by: andypb123 | last post by:
Hello, The onchange event fires in IE6 in a SELECT element when scrolling through the list with the up and down arrows on the keyboard. In Firefox it only fires after you hit the enter key, which...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.