Web Analytics Made Easy -
StatCounter How To Make Combo List ? - CodingForum

Announcement

Collapse
No announcement yet.

How To Make Combo List ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How To Make Combo List ?

    Hello,

    Is there anyway to make combo list in the HTML form ? By
    using this "<select name ....></select>", the list only recognise
    first keypress, but this is not good enought for user to select
    the data from the list especially with long list.

    Eg. the data in the list.
    ABC
    ADD
    AZZ
    BBA
    BBD
    ....

    What I want is when user enter "AD", the list will automatically
    jump to "ADD".

    Is this possible ? Please help.

    Regards,

  • #2
    Try this. It might need some small adjustments, but I think it achieves your purpose.

    PHP Code:
    <html>
    <
    head>
    <
    script>
    function 
    capture(evt) {
    var 
    document.layers evt.which 
                
    document.all event.keyCode
                
    evt.keyCode;
    var 
    String.fromCharCode(c)            
    sel(s);
    }
    var 
    ss='';
    var 
    count=0;
    function 
    sel(wh){
    d=document.forms[0];
    ss ss+wh;
    count++;
    if(
    count == 2){
    var 
    str= new Array()
    var 
    = new Array()
    for (
    i=1;i<d.sel.length;i++){
    str[i] = d.sel.options[i].text.toLowerCase();
    cha str[i].split('');
    var 
    qq '';
        for(
    j=0;j<count;j++){qq qq+cha[j];}
    q[i] = qq;
    if(
    q[i] == ss){
    opt = new Option();
    opt.selectedIndex i;
    d.sel.selectedIndex opt.selectedIndex;
    break}
    }}}
    </
    script>
    </
    head>

    <
    body>
    <
    form>
    <
    select name="sel" onkeypress="capture(this);return false">
    <
    option>select..</option>
      <
    option>ABC</option>
      <
    option>ADD</option>
      <
    option>AZZ</option>
      <
    option>BBA</option>
      <
    option>BBD</option>
    </
    select>
    </
    form>
    </
    body>
    </
    html
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

    Comment


    • #3
      Check out the Editable Type-ahead combo script in my sig.
      Glenn
      vBulletin Mods That Rock!

      Comment

      Working...
      X