views:

299

answers:

2

Is it possible to show the list of items in a dropdown list when the user presses the up or down arrow keys, when focus is on that dropdown control? I think this would involve sending an onclick to the dropdown list using onkeydown for Keycode 38(arrow up) & 40(arrow down)? But I cannot figure out how to do this.

A: 

Hi,

this is probably not the best solution, but it works:

<select onmouseover="this.size=this.length" onmouseout="this.size=1">
  <option value="1">Test1</option>
  <option value="2">Test2</option>
  <option value="3">Test3</option>
</select>

I think that there is not any other simple solutions. Oh, I see... my code pushes the rest of the page down. You can improve it, just add the following attribute to the SELECT tag:

style="z-index: 100; position: absolute;"

But you will have to play a little bit with IE6 and overlapping over other forms/flash.

oneee
Thank you for your help.
P Nelson
A: 

I can only think of changing the size attribute, but that's more of a workaround.

Reinis I.
Thanks for your help.
P Nelson