asp.net 中 DropDownList 输入问题的最简单解决方案
来源:互联网 发布:mac解压bin文件 编辑:程序博客网 时间:2024/05/21 11:23
先把这段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中dropdownlist使用的问题
- asp.net的DropDownList问题
- asp.net 可选可输入的dropdownlist
- 关于asp.net中DropDownList问题
- Asp.net 随机生成数组最简单的解决方案
- ASP.NET MVC中DROPDOWNLIST的使用
- ASP.NET MVC中DropDownList的使用
- asp.net 2.0可输入的Dropdownlist控件
- asp.net连接MYSQL的SQL语句中有汉字问题最简单、最终的解决方法
- 请问如何解决asp.net 中dropdownlist使用的奇怪问题
- ASP.NET中url传递中文的解决方案简单汇总
- asp.net中最简单的调用存储过程实例
- (转)关于ASP.NET控件DropDownList控件的问题
- ASP.NET程序中常用代码汇总
- [翻译]在Visual C++ Express 2005中使用WTL
- 关于showModalDialog和showModelessDialog路径问题
- smarty 分列显示:有些可以变得更简单
- adodb-smarty 实例教程
- asp.net 中 DropDownList 输入问题的最简单解决方案
- 最齐的软件路由器免费资源下载
- 新的一天,新的开始
- Smarty 入門
- 获取并打印汉字点阵
- 软件路由器经典十问
- 香港爱情电影二十四经
- oracle笔记整理一[体系结构简介]
- 多个Select标签数据过滤的动态显示