<option onmousover> and auto-scrolling <select> lists

Discussion in 'Javascript' started by Richard Maher, Apr 10, 2007.

  1. Hi,

    I have a Select-List that I wish to populate at run-time with a list of
    options that is currently matching the characters that the user is typing
    in. That bit's working fine; what I'd also like to do is have the Select-Bar
    automatically move over the options with the mouse. In other words, emulate
    what the browser currently does when entering a new URL and matching the
    keystrokes to what's in history.

    I can see that the <option> tag quite happily takes the onmousover event and
    I assume that I can set the list.selectedIndex to the option that I'm
    currently travelling over but how do I set it all up?

    1) Do I have to so something with Prototypes or the Option objects so that
    all of the new Options get the onmousover=myFunction() functionality?
    2) Do I have to use some sort of xxxAttribute() functionality
    3) Even if I manage to get my function called (possibly with "this") I can't
    see an options.index attribute that I could use with the selectedIndex list
    attribute. How do I know what option I'm on?
    4) When I'm at the limits of viewable range of options how do I know to
    scroll up or down if the user isn't using the scroll-bar?

    Any help much appreciated! An example would be even better :)

    Cheers Richard Maher
     
    Richard Maher, Apr 10, 2007
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.