如何设置select 里的option行距

如何设置select 里的option行距,第1张

有时候我们需要在一个Select中传递两个有关联但不同的值,比如你的这个情况。这时候要利用到Option的另一个不常用属性Name,用Name来存储第二个值,然后在onchange事件中分别用this.options[this.selectedIndex].name来调用这个值。

<select name="opt" onchange="optt.value=this.options[this.selectedIndex].name">

<option name="全12333" value="123323">全12333</option>

<option name="全12321" value="121113">全12321</option>

<option name="全123123" value="121323">全123123</option>

</select>

<input name="optt" type="hidden" value="">

在你的程序里,把<option></option>之间的内容作为name属性写出来,然后定义一个隐藏的input——optt,再定义好onchange事件,就可以同时获取到value和name两个值了。

直接添加样式 select option{line-height:30pxheight:30pxmargin:5px auto}

这样可以的 如果你觉得答案可以 就给分吧

<Controls>

<Window parent="">

<Attribute name="size" default="0,0" type="SIZE" comment="窗口的初始化大小,如(800,600)"/>

<Attribute name="sizebox" default="0,0,0,0" type="RECT" comment="窗口可拖动改变窗口大小的边距,如(4,4,6,6)"/>

<Attribute name="caption" default="0,0,0,0" type="RECT" comment="窗口可拖动的标题栏大小的边距,最后一个参数是指离上边框的距离,如(0,0,0,28)"/>

<Attribute name="roundcorner" default="0,0" type="SIZE" comment="窗口圆角大小,如(4,4)"/>

<Attribute name="mininfo" default="0,0" type="SIZE" comment="窗口最小大小,如(320,240)"/>

<Attribute name="maxinfo" default="0,0" type="SIZE" comment="窗口最大大小,如(1600,1200)"/>

<Attribute name="alpha" default="255" type="BYTE" comment="窗口的alpha值(0-255),如(100)"/>

<Attribute name="bktrans" default="false" type="BOOL" comment="窗口是否使用静态透明背景,如(false)"/>

<Attribute name="disabledfontcolor" default="0xFFA7A6AA" type="DWORD" comment="默认的disabled字体颜色,如(0xFFA7A6AA)"/>

<Attribute name="defaultfontcolor" default="0xFF000000" type="DWORD" comment="默认的字体颜色,如(0xFF000000)"/>

<Attribute name="linkfontcolor" default="0xFF0000FF" type="DWORD" comment="默认的link字体颜色,如(0xFF0000FF)"/>

<Attribute name="linkhoverfontcolor" default="0xFFD3215F" type="DWORD" comment="默认的linkhoverfont字体颜色,如(0xFFD3215F)"/>

<Attribute name="selectedcolor" default="0xFFBAE4FF" type="DWORD" comment="默认的selected字体颜色,如(0xFFBAE4FF)"/>

<Attribute name="showdirty" default="false" type="BOOL" comment="绘制脏矩形(屏幕上更新的区域被称为脏矩形)"/>

</Window>

<ChildLayout parent="Container" >

<Attribute name="xmlfile" default="" type="STRING" comment="子窗体XML布局文件"/>

</ChildLayout>

<Control parent="" notifies="setfocus killfocus timer menu windowinit(root)">

<Attribute name="name" default="" type="STRING" comment="控件名字,同一窗口内必须唯一,如(testbtn)"/>

<Attribute name="pos" default="0,0,0,0" type="RECT" comment="位置,如果为float控件则指定位置和大小,否则只指定大小,如(0,0,100,100)"/>

<Attribute name="padding" default="0,0,0,0" type="RECT" comment="外边距,如(2,2,2,2)"/>

<Attribute name="bkcolor" default="0x00000000" type="DWORD" comment="背景颜色,如(0xFFFF0000)"/>

<Attribute name="bkcolor2" default="0x00000000" type="DWORD" comment="背景渐变色2,和bkcolor配合使用,如(0xFFFFFF00)"/>

<Attribute name="bkcolor3" default="0x00000000" type="DWORD" comment="背景渐变色3,和bkcolor、bkcolor2配合使用,如(0xFFFF00FF)"/>

<Attribute name="bordercolor" default="0x00000000" type="DWORD" comment="边框颜色,如(0xFF000000)"/>

<Attribute name="focusbordercolor" default="0x00000000" type="DWORD" comment="获得焦点时边框的颜色,如(0xFFFF0000)"/>

<Attribute name="colorhsl" default="false" type="BOOL" comment="本控件的颜色是否随窗口的hsl变化而变化,如(false)"/>

<Attribute name="bordersize" default="0" type="INT | RECT" comment="可以设置INT或RECT类型的值。当值为ING时则左、上、右、下都用该值作为宽。值为RECT类型时则分别设置左、上、右、下的边框"/>

<Attribute name="leftbordersize" default="0" type="INT" comment="左边边框大小,如(1),设置该值大于0,则将忽略bordersize属性的设置"/>

<Attribute name="topbordersize" default="0" type="INT" comment="顶部边框大小,如(1),设置该值大于0,则将忽略bordersize属性的设置"/>

<Attribute name="rightbordersize" default="0" type="INT" comment="右边边框大小,如(1),设置该值大于0,则将忽略bordersize属性的设置"/>

<Attribute name="bottombordersize" default="0" type="INT" comment="底部边框大小,如(1),设置该值大于0,则将忽略bordersize属性的设置"/>

<Attribute name="borderstyle" default="0" type="INT" comment="边框样式的设置,数值范围0-5"/>

<Attribute name="borderround" default="0,0" type="SIZE" comment="边框圆角半径,如(2,2)"/>

<Attribute name="bkimage" default="" type="STRING" comment="背景图片,如(bk.bmp或file='aaa.jpg' res='' restype='0' dest='0,0,0,0' source='0,0,0,0' corner='0,0,0,0' mask='#FF0000' fade='255' hole='false' xtiled='false' ytiled='false')"/>

<Attribute name="width" default="0" type="INT" comment="控件预设的宽度,如(100)"/>

<Attribute name="height" default="0" type="INT" comment="控件预设的高度,如(30)"/>

<Attribute name="minwidth" default="0" type="INT" comment="控件的最小宽度,如(100)"/>

<Attribute name="minheight" default="0" type="INT" comment="控件的最小高度,如(30)"/>

<Attribute name="maxwidth" default="9999" type="INT" comment="控件的最大宽度,如(100)"/>

<Attribute name="maxheight" default="9999" type="INT" comment="控件的最大高度,如(30)"/>

<Attribute name="text" default="" type="STRING" comment="显示文本,如(测试文本)"/>

<Attribute name="tooltip" default="" type="STRING" comment="鼠标悬浮提示,如(请在这里输入你的密码)"/>

<Attribute name="userdata" default="" type="STRING" comment="自定义标识"/>

<Attribute name="enabled" default="true" type="BOOL" comment="是否可以响应用户 *** 作,如(true)"/>

<Attribute name="mouse" default="true" type="BOOL" comment="本控件是否可以响应鼠标 *** 作,如(true)"/>

<Attribute name="visible" default="true" type="BOOL" comment="是否可见,如(true)"/>

<Attribute name="float" default="false" type="BOOL" comment="是否使用绝对定位,如(true)"/>

<Attribute name="shortcut" default="" type="CHAR" comment="对应的快捷键,如(P)"/>

<Attribute name="menu" default="false" type="BOOL" comment="是否需要右键菜单,如(true)"/>

<Attribute name="keyboard" default="true" type="BOOL" comment="非CButtonUI类忽略该值,为false时不支持TAB_STOP,且该对象不处理键盘信息"/>

</Control>

<Container parent="Control" notifies="setfocus killfocus timer menu windowinit(root)">

<Attribute name="name" default="" type="STRING" comment="控件名字,同一窗口内必须唯一,如(testbtn)"/>

<Attribute name="pos" default="0,0,0,0" type="RECT" comment="位置,如果为float控件则指定位置和大小,否则只指定大小,如(0,0,100,100)"/>

<Attribute name="padding" default="0,0,0,0" type="RECT" comment="外边距,如(2,2,2,2)"/>

<Attribute name="bkcolor" default="0x00000000" type="DWORD" comment="背景颜色,如(0xFFFF0000)"/>

<Attribute name="bkcolor2" default="0x00000000" type="DWORD" comment="背景渐变色2,和bkcolor配合使用,如(0xFFFFFF00)"/>

<Attribute name="bkcolor3" default="0x00000000" type="DWORD" comment="背景渐变色3,和bkcolor、bkcolor2配合使用,如(0xFFFF00FF)"/>

<Attribute name="bordercolor" default="0x00000000" type="DWORD" comment="边框颜色,如(0xFF000000)"/>

<Attribute name="focusbordercolor" default="0x00000000" type="DWORD" comment="获得焦点时边框的颜色,如(0xFFFF0000)"/>

<Attribute name="colorhsl" default="false" type="BOOL" comment="本控件的颜色是否随窗口的hsl变化而变化,如(false)"/>

<Attribute name="bordersize" default="1" type="INT" comment="边框大小,如(1)"/>

<Attribute name="borderround" default="0,0" type="SIZE" comment="边框圆角半径,如(2,2)"/>

<Attribute name="bkimage" default="" type="STRING" comment="背景图片,如(bk.bmp或file='aaa.jpg' res='' restype='0' dest='0,0,0,0' source='0,0,0,0' corner='0,0,0,0' mask='#FF0000' fade='255' hole='false' xtiled='false' ytiled='false')"/>

<Attribute name="width" default="0" type="INT" comment="控件预设的宽度,如(100)"/>

<Attribute name="height" default="0" type="INT" comment="控件预设的高度,如(30)"/>

<Attribute name="minwidth" default="0" type="INT" comment="控件的最小宽度,如(100)"/>

<Attribute name="minheight" default="0" type="INT" comment="控件的最小高度,如(30)"/>

<Attribute name="maxwidth" default="9999" type="INT" comment="控件的最大宽度,如(100)"/>

<Attribute name="maxheight" default="9999" type="INT" comment="控件的最大高度,如(30)"/>

<Attribute name="text" default="" type="STRING" comment="显示文本,如(测试文本)"/>

<Attribute name="tooltip" default="" type="STRING" comment="鼠标悬浮提示,如(请在这里输入你的密码)"/>

<Attribute name="userdata" default="" type="STRING" comment="自定义标识"/>

<Attribute name="enabled" default="true" type="BOOL" comment="是否可以响应用户 *** 作,如(true)"/>

<Attribute name="mouse" default="true" type="BOOL" comment="本控件是否可以响应鼠标 *** 作,如(true)"/>

<Attribute name="mousechild" default="true" type="BOOL" comment="本控件的子控件是否可以响应用户 *** 作,如(true)"/>

<Attribute name="visible" default="true" type="BOOL" comment="是否可见,如(true)"/>

<Attribute name="float" default="false" type="BOOL" comment="是否使用绝对定位,如(true)"/>

<Attribute name="shortcut" default="" type="CHAR" comment="对应的快捷键,如(P)"/>

<Attribute name="menu" default="false" type="BOOL" comment="是否需要右键菜单,如(true)"/>

<Attribute name="inset" default="0,0,0,0" type="RECT" comment="容器的内边距,如(2,2,2,2)"/>

<Attribute name="vscrollbar" default="false" type="BOOL" comment="是否使用竖向滚动条,如(true)"/>

<Attribute name="hscrollbar" default="false" type="BOOL" comment="是否使用横向滚动条,如(true)"/>

<Attribute name="childpadding" default="0" type="INT" comment="子控件之间的额外距离,如(4)"/>

</Container>

<VerticalLayout parent="Container" notifies="setfocus killfocus timer menu windowinit(root)">

<Attribute name="name" default="" type="STRING" comment="控件名字,同一窗口内必须唯一,如(testbtn)"/>

<Attribute name="pos" default="0,0,0,0" type="RECT" comment="位置,如果为float控件则指定位置和大小,否则只指定大小,如(0,0,100,100)"/>

<Attribute name="padding" default="0,0,0,0" type="RECT" comment="外边距,如(2,2,2,2)"/>

<Attribute name="bkcolor" default="0x00000000" type="DWORD" comment="背景颜色,如(0xFFFF0000)"/>

<Attribute name="bkcolor2" default="0x00000000" type="DWORD" comment="背景渐变色2,和bkcolor配合使用,如(0xFFFFFF00)"/>

<Attribute name="bkcolor3" default="0x00000000" type="DWORD" comment="背景渐变色3,和bkcolor、bkcolor2配合使用,如(0xFFFF00FF)"/>

<Attribute name="bordercolor" default="0x00000000" type="DWORD" comment="边框颜色,如(0xFF000000)"/>

<Attribute name="focusbordercolor" default="0x00000000" type="DWORD" comment="获得焦点时边框的颜色,如(0xFFFF0000)"/>

<Attribute name="colorhsl" default="false" type="BOOL" comment="本控件的颜色是否随窗口的hsl变化而变化,如(false)"/>

<Attribute name="bordersize" default="1" type="INT" comment="边框大小,如(1)"/>

<Attribute name="borderround" default="0,0" type="SIZE" comment="边框圆角半径,如(2,2)"/>

<Attribute name="bkimage" default="" type="STRING" comment="背景图片,如(bk.bmp或file='aaa.jpg' res='' restype='0' dest='0,0,0,0' source='0,0,0,0' corner='0,0,0,0' mask='#FF0000' fade='255' hole='false' xtiled='false' ytiled='false')"/>

<Attribute name="width" default="0" type="INT" comment="控件预设的宽度,如(100)"/>

<Attribute name="height" default="0" type="INT" comment="控件预设的高度,如(30)"/>

<Attribute name="minwidth" default="0" type="INT" comment="控件的最小宽度,如(100)"/>

<Attribute name="minheight" default="0" type="INT" comment="控件的最小高度,如(30)"/>

<Attribute name="maxwidth" default="9999" type="INT" comment="控件的最大宽度,如(100)"/>

<Attribute name="maxheight" default="9999" type="INT" comment="控件的最大高度,如(30)"/>

<Attribute name="text" default="" type="STRING" comment="显示文本,如(测试文本)"/>

<Attribute name="tooltip" default="" type="STRING" comment="鼠标悬浮提示,如(请在这里输入你的密码)"/>

<Attribute name="userdata" default="" type="STRING" comment="自定义标识"/>

<Attribute name="enabled" default="true" type="BOOL" comment="是否可以响应用户 *** 作,如(true)"/>


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11527473.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-16
下一篇 2023-05-16

发表评论

登录后才能评论

评论列表(0条)

保存