在dropDownList中實現(xiàn)既能輸入一個新值又能實現(xiàn)下拉選的代碼
更新時間:2013年04月10日 16:58:57 作者:
在dropDownList中實現(xiàn)既能輸入一個新值,又能實現(xiàn)下拉選項,想必很多的朋友已經(jīng)為此功能按耐不住了吧,接下來與大家分享下如何實現(xiàn),感興趣的朋友可以參考下哈
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)";
}
}
復(fù)制代碼 代碼如下:
<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:
復(fù)制代碼 代碼如下:
page_load()
{
if (!IsPostBack)
{
workerno_list.Attributes["onchange"] = "addTxtTanto(this.options[selectedIndex].innerText)";
}
}
您可能感興趣的文章:
- DropDownList 下拉框選擇改變促發(fā)事件和防全局刷新(推薦)
- DropDownList綁定選擇數(shù)據(jù)報錯提示異常解決方案
- 用javascript為DropDownList控件下拉式選擇添加一個Item至定義索引位置
- asp.net中不能在DropDownList中選擇多個項 原因分析及解決方法
- ASP.NET中DropDownList下拉框列表控件綁定數(shù)據(jù)的4種方法
- C#使用DropDownList綁定添加新數(shù)據(jù)的方法匯總
- asp.net DropDownList實現(xiàn)二級聯(lián)動效果
- DropDownList添加客戶端下拉事件操作
- DropDownList實現(xiàn)可輸入可選擇(兩種版本可選)
相關(guān)文章
在ASP.NET中用MSDNURLRewriting實現(xiàn)Url Rewriting
在ASP.NET中用MSDNURLRewriting實現(xiàn)Url Rewriting...2007-03-03asp.net下xml當(dāng)作導(dǎo)航數(shù)據(jù)源實現(xiàn)動態(tài)權(quán)限
如果有權(quán)限的話 可以通過節(jié)點的Roles屬性判斷當(dāng)前登陸的賬號角色名是否符合然后判斷輸出這樣的話您就可以直接操作XML數(shù)據(jù) 而不用考慮別的。2009-12-12ASP.NET MVC中SignalR的簡單應(yīng)用
這篇文章主要為大家詳細介紹了ASP.NET MVC中SignalR的簡單應(yīng)用,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-07-07ASP.NET用戶注冊實戰(zhàn)(第11節(jié))
這篇文章主要介紹了ASP.NET用戶注冊實戰(zhàn),鞏固前10小節(jié)所學(xué)的全部知識,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下2015-08-08.NET?Core利用?AsyncLocal?實現(xiàn)共享變量的代碼詳解
在Web?應(yīng)用程序中,我們經(jīng)常會遇到這樣的場景,如用戶信息,租戶信息本次的請求過程中都是固定的,我們希望是這種信息在本次請求內(nèi),一次賦值,到處使用。本文就來探討一下,如何在.NET?Core?下去利用AsyncLocal?實現(xiàn)全局共享變量2022-04-04