Is there a way to set the default "viewing" index for a DropdownList via Javascript?
I have a Dropdownlist or maybe better described as a "select" control. This list can have 50 to 100 items in it. Lets just say it's showing numerically 1 through 50.
I would like the control to show on the form with no selected value, however when the user clicks/focuses on it - I would like to have what appears to the user as the expanded list showing on items 20-40, with say item 30 being selected or highlighted.
Right now I have tried it with a focus event, and setting the selected value - however I have to set the selected value about 9-10 past what I actually want centered in the list.
Also, if the user ends up clicking outside of the box accidently I will end up 开发者_运维技巧capturing the default value I set.
Any ideas?
Thank you.
This is not doable with the generic <select>
tag, and seems painfully nitpicky. You might want to consider either (a) not caring, or (b) using Javascript to create your own dropdown control.
精彩评论