网络编程 
首页 > 网络编程 > 浏览文章

在dropDownList中实现既能输入一个新值又能实现下拉选的代码

(编辑:jimmy 日期: 2024/5/10 浏览:3 次 )
aspx:
复制代码 代码如下:
<div id="selDiv" style=" z-index:100; visibility:visible; clip:rect(0px 110px 80px 92px); position:absolute"><%--left:279px; top:167px"--%>
<asp:DropDownList ID="workerno_list" runat="server" style="z-index:-1" Width="110px" ></asp:DropDownList>
</div>
<asp:TextBox ID="workerno_value" runat="server" style=" z-index:103px; position:absolute" Font-Size="10" Width="93px" MaxLength ="50" Height="22px"></asp:TextBox>
<script>
function addTxtTanto(va)
{
document.getElementById("workerno_value").value=va;
document.getElementById("workerno_value").select();
}
</script>

aspx.cs:
复制代码 代码如下:
page_load()
{
if (!IsPostBack)
{
workerno_list.Attributes["onchange"] = "addTxtTanto(this.options[selectedIndex].innerText)";
}
}
上一篇:对ListBox的添加移除操作实例分享
下一篇:GridView分页的实现(通用分页模板)
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网