下拉列表的滚动条

scrollbar for the dropdown list

本文关键字:滚动条 下拉列表      更新时间:2023-09-26

我想显示下拉列表的滚动条,以便用户可以从可用列表中选择任何。下拉菜单应该显示5个项目和一个滚动条,当用户单击下拉列表时,可以拖动并看到列表中剩余的项目。为了显示下拉列表,我使用struts html标签库。下面是显示下拉列表的struts html代码。

 <html:select name="myForm" property="city" styleId="city" tabindex="1" title="Please Select City">
  <html:options property="city" labelProperty="city"/>
 </html:select>

我需要写javascript函数来实现滚动条的<html:options>。我不能使用jQuery,因为我的应用程序不支持jQuery库。请建议我如何使用javascript函数实现此目标。

简单地分配一个类到选项列表,并添加溢出等于auto。我只是添加了style。

<html:select name="myForm" property="city" styleId="city" tabindex="1" title="Please Select City">