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

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

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

  2021-03-18 我要评论
想了解在dropDownList中实现既能输入一个新值又能实现下拉选的代码的相关内容吗,在本文为您仔细讲解dropDownList 输入 下拉选项的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:dropDownList,输入,下拉选项,下面大家一起来学习吧。
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)";
}
}

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们