在dropDownList中实现既能输入一个新值又能实现下拉选的代码
程序员文章站
2024-03-02 14:23:34
aspx: 复制代码 代码如下:
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)";
}
}
复制代码 代码如下:
<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)";
}
}
上一篇: Python数据操作方法封装类实例
下一篇: Lucene实现多种高级搜索形式