可填可选的下拉菜单

主要是运用CSS实现的效果,代码如下:

年龄:<asp:TextBox ID="tbxAge" Runat="server" Style="width:100px; position:absolute; margin-top:-5px" />
    
<asp:DropDownList ID="ddlAge" Runat="server"
        Style
="width:118px; margin-top:-5px; margin-left:-5px; Clip:rect(auto auto auto 100px); position:absolute"
        onchange
="document.getElementById('tbxAge').value = this.options[this.selectedIndex].text"
    
>
    
<asp:ListItem>22</asp:ListItem>
    
<asp:ListItem>23</asp:ListItem>
    
</asp:DropDownList>

rect ( number number number number )
依据上-右-下-左的顺序提供自对象左上角为(0,0)坐标计算的四个偏移数值,其中任一数值都可用 auto 替换,即此边不剪切;必须将 position 属性的值设为 absolute ,此属性方可使用。
 
下拉菜单长度 = 文本框长度 + 18px
rect设置 :(auto auto auto 文本框长度)

嘿嘿,有时间自己也弄一个控件来。

参考文档:http://kwklover.cnblogs.com/archive/2005/11/23/282879.html
posted @ 2005-12-18 00:55  jeky  阅读(518)  评论(0编辑  收藏  举报
友情链接:逗死了笑话网 | 网络记事本