如何设置下拉选择框的高度 [英] How to Set Height for the Drop Down of Select box

查看:178
本文介绍了如何设置下拉选择框的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当选项数超过20时,我的选择框会显示滚动。

my selectbox is showing scroll when number of options are more than 20 i just want to show scrol in when options are more than 10

 <select>
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    <option>5</option>
    <option>6</option>
    <option>7</option>
    <option>8</option>
    <option>9</option>
    <option>10</option>
    <option>11</option>
  </select>


推荐答案

尝试将此添加到 < select> 标签:

onfocus='this.size=10;' 
onblur='this.size=1;' 
onchange='this.size=1; this.blur();

like:

   <select onfocus='this.size=10;' onblur='this.size=1;' 
        onchange='this.size=1; this.blur();'>

SAMPLE DEMO

SAMPLE DEMO

这篇关于如何设置下拉选择框的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆