Show just some options in in HTML drop down list

2019-07-31 10:39发布

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.

3条回答
一纸荒年 Trace。
2楼-- · 2019-07-31 10:52

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.

查看更多
地球回转人心会变
3楼-- · 2019-07-31 10:54

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

查看更多
爷的心禁止访问
4楼-- · 2019-07-31 11:02
<select multiple="multiple" size="10">
查看更多
登录 后发表回答