日期:2014-05-17  浏览次数:20695 次

如何实现既可自定义输入又可选择的下拉框
想要做这么一个下拉框,既可以选择某一项,也可以在框框里自己手动写东西(目的不是为了加到下拉列表中)。

大神们给点指导,我刚学这个。谢了,对了,我使用Java做的开发。

------解决方案--------------------
这个我做过,看下面的代码
Java code
            <div style="position:relative;" id="model1" >   
            
                <span style="margin-left:132px;width:18px;overflow:hidden;">   
                    <s:select name="subscribe.modelId" cssClass="textfield"
                        listKey="mcode" listValue="mname" list="modelList" emptyOption="true"
                        cssStyle="width:150px;margin-left:-132px" 
                        onchange="document.getElementById('assets.modelName').value=document.getElementById('subscribe.modelId').options[document.getElementById('subscribe.modelId').selectedIndex].innerText;"/>
                    
                </span>
                <s:textfield name="assets.modelName"
                     id="assets.modelName"
                    cssStyle="width:132px;position:absolute;left:0px;" maxlength="50" />
                    
            </div>

------解决方案--------------------
以前我也有这样的需求。 。我是在下拉菜单上面放了一个文本框但是没有遮住下来菜单的向下按钮。。这样应该就可以。