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


R

Richard Maher

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
 
Ad

Advertisements


Top