asp.net 中 DropDownList 加入可输入功能解决方案
来源:互联网 发布:为什么要使用域名 编辑:程序博客网 时间:2024/05/19 17:03
先把这段JS代码放到你页面的HTML中去
function catch_keydown(sel) { switch(event.keyCode) {
case 13: //Enter;
sel.options[sel.length] = new Option("","",false,true);
event.returnValue = false;
break;
case 27: //Esc;
alert("text:" + sel.options[sel.selectedIndex].text + ", value:" + sel.options[sel.selectedIndex].value + ";");
event.returnValue = false;
break;
case 46: //Delete;
if(confirm("刪除當前內容!?")) {
sel.options[sel.selectedIndex] = null;
if(sel.length>0) { sel.options[0].selected = true; } }
event.returnValue = false; break;
case 8: //Back Space;
var s = sel.options[sel.selectedIndex].text;
sel.options[sel.selectedIndex].text = s.substr(0,s.length-1);
event.returnValue = false; break; } }
function catch_press(sel) {
sel.options[sel.selectedIndex].text = sel.options[sel.selectedIndex].text + String.fromCharCode
(event.keyCode); event.returnValue = false;
}
然后在你的程序中拖拽一个 DropDownList 控件,在到HTML页中找到这个 控件的 代码
在他后面加上 onkeydown="catch_keydown(this);" onkeypress="catch_press(this);"
运行程序就好了
- asp.net 中 DropDownList 加入可输入功能解决方案
- asp.net 中 DropDownList 输入问题的最简单解决方案
- asp.net 中 DropDownList 输入问题的最简单解决方案
- ASP.NET 中 DropDownList 输入问题的最简单解决方案
- asp.net 可选可输入的dropdownlist
- asp.net 2.0可输入的Dropdownlist控件
- (转)在asp.net 页面中加入skype功能
- (转)在asp.net 页面中加入skype功能
- 实现DropDownList可输入
- ASP.NET给 DropDownList列表Text前加入空格
- ASP.NET中如何让DropDownList控件既能做选择又能做输入用?
- asp.net:gridview 中嵌套dropdownlist,且dropdownlist動態綁定數據
- ASP.NET 可编辑的下拉框(DropDownList)
- ASP.NET 可编辑的下拉框(DropDownList)
- asp.net DropDownList 可输可选 下拉菜单
- asp.net中使用dropdownlist的问题
- asp.net中DropDownList动态加载数据
- ASP.NET中实现Ajax级联DropDownList
- 阿凡达有感
- 三星电子书发布啦! 含手写识别和Wi-Fi功能
- 英语面试技巧2
- 文件夹无法访问、拒绝访问的解决方法
- 对双缓冲技术的一点理解!
- asp.net 中 DropDownList 加入可输入功能解决方案
- phpcms和dz,phpwind整合详解(上)
- AjaxControlToolKit DropDownExtender(下拉扩展控件)使用方法
- phpcms和dz整合详解( 下)
- 美语系列141
- joolma 和phpbb3整合教程
- 警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ..
- joomla和phpbb整合利用rocbright详解
- Application "XXX" could not be found in the registry的解决办法