$.fn.selectHelper = function(){
$(this).bind("keydown",function(){
getNextKeyItem();
});
getNextKeyItem = function(){
var elm = event.srcElement;
var index = elm.selectedIndex + 1;
do {
if (index == elm.length)
index = 0;
if (index == elm.selectedIndex)
return false; // 未找到匹配的选项,则退出
}
while (key2Char(event.keyCode) != getPinYin(getItemKeyChar(elm.options[index++])));
elm.selectedIndex = index - 1; // 选中匹配的选项
return false; // 取消原有的选择功能
}
getItemKeyChar = function(option){
return option.text.charAt(0).toUpperCase();
}
key2Char = function(key){
var s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if (key >= 97 && key <= 122)
return s.charAt(key - 97);
if (key >= 65 && key <= 90)
return s.charAt(key - 65);
if (key >= 48 && key <= 57)
return "" + (key - 48);
return null;
}
getPinYin = function(c){
execScript("tmp=asc(\"" + c + "\")", "vbscript");
tmp = 65536 + tmp;
if (tmp >= 45217 && tmp <= 45252)
return "A";
if (tmp >= 45253 && tmp <= 45760)
return "B";
if (tmp >= 45761 && tmp <= 46317)
return "C";
if (tmp >= 46318 && tmp <= 46825)
return "D";
if (tmp >= 46826 && tmp <= 47009)
return "E";
if (tmp >= 47010 && tmp <= 47296)
return "F";
if ((tmp >= 47297 && tmp <= 47613) || (tmp == 63193))
return "G";
if (tmp >= 47614 && tmp <= 48118)
return "H";
if (tmp >= 48119 && tmp <= 49061)
return "J";
if (tmp >= 49062 && tmp <= 49323)
return "K";
if (tmp >= 49324 && tmp <= 49895)
return "L";
if (tmp >= 49896 && tmp <= 50370)
return "M";
if (tmp >= 50371 && tmp <= 50613)
return "N";
if (tmp >= 50614 && tmp <= 50621)
return "O";
if (tmp >= 50622 && tmp <= 50905)
return "P";
if (tmp >= 50906 && tmp <= 51386)
return "Q";
if (tmp >= 51387 && tmp <= 51445)
return "R";
if (tmp >= 51446 && tmp <= 52217)
return "S";
if (tmp >= 52218 && tmp <= 52697)
return "T";
if (tmp >= 52698 && tmp <= 52979)
return "W";
if (tmp >= 52980 && tmp <= 53688)
return "X";
if (tmp >= 53689 && tmp <= 54480)
return "Y";
if (tmp >= 54481 && tmp <= 62289)
return "Z";
return c.charAt(0);
}
}
分享到:
相关推荐
简单实用的jquery select2组件
jquery select2 select美化插件
一组经过美化的jQuery select下拉框单选和多选插件,带搜索功能,模拟select下拉框多选菜单选择效果。
jQuery多级下拉select选择菜单插
,默认一个input输入框,点击后下拉框可以快速选择今天,或者过去七天、过去一年时间、上个月时间等快捷选择方式,或者弹出日历选择器提供选择
jquery.searchableSelect。select插件,jQuery下拉选择框代码。带搜索功能的选择框代码。
SelectPage.js是一款强大的jquery下拉分页选择插件。SelectPage.js下拉分页选择插件界面简洁,支持下拉,分页,键盘操作等功能。
jquery下拉框选择select美化插件FancySelect.js
Jquery select 插件 select
jquery 封装select实现select自定义样式的完美插件jquery.easydropdown.min.js
jquery 超级select插件 v4.0版本
jQuery Select下拉框分类菜单多选插件一款功能比较全面的自定义下拉菜单选项多选代码,除了可以对选项进行分类,还带有搜索功能。
Jquery模拟select效果实现,纯自写,简单实用,可自行修改样式。
select选择框控件-jquery.editable-select,并且可以编辑,可以输入
jQuery Select(单选) 模拟插件 V1.3.6
仿苹果select jquery 插件,可用于手机端
select 检索插件jquery框架,根据输入内容自动过滤select 选项
一款功能齐全的jQuery Select下拉框菜单选择插件,支持设置多选,单选,分组选择,禁用,搜索等常用的下拉框菜单选择功能。
jquery的select美化插件。还不是很完善。附带jquery1.5