Show just some options in in HTML drop down list

2019-07-31 10:13发布

问题:

How can I show 10 option out of 100 in the drop down list and the rest to be available using scrollbar?

thanks a lot.

回答1:

You could try this little trick...

<select max="2" onmouseover="this.size = 10" onmouseout="this.size = 1">

it effectively makes your select drop down into a list on mouse over and puts it back on mouse out.

it's cheating and can mess up your html positioning, but it works.

Edit: I'm pretty sure you can't change the size of the menu displayed when you click a select, this is determined by the browser and not controllable by the page.



回答2:

<select multiple="multiple" size="10">


回答3:

I think <select multiple="multiple" size="10"> produces a list, not a drop down...