Keydown should be the event you are looking for...

Event.observe(window, 'keydown', function(ev) {
  var key = (window.event) ? window.event.keyCode : ev.which;

  switch(key) {
    case Event.KEYUP:
      this.moveUp();
      break;
    case Event.KEYDOWN:
      this.moveDown();
      break;
  }
}.bind(this));

the window will keep firing this event as long as the key is pressed
so it will keep calling the moveDown-method. If you keep a reference
within your js object to the current selected item, you should be able
to take it from here...

On Nov 13, 1:37 pm, Matt <[EMAIL PROTECTED]> wrote:
> Hi all
>
> I've implemented a typeahead/live search widget and currently allow
> iteration through the dropdown list using the arrow keys.
>
> At the moment, the selection only moves once each time the arrow
> button is pressed (keydown).
>
> Is it possible to keep iterating through the items in the dropdown for
> as long as the key is held down?
>
> Example:http://www.google.com/webhp?complete=1&hl=en
>
> Many thanks


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to