easyui中方向键、tab键、回车键
2016-01-07 18:16
681 查看
1.html中
function changeTab(event, i) { var keyCode = event.keyCode; var inputs = jQuery("#table :input"); // 获取表单中的所有输入框 var idx = inputs.index(i); if (inputs.length < 4) { return false; } if(idx >= inputs.length - 3){ switch (keyCode) { case 38: //↑ inputs[idx - 3].focus(); // 设置焦点 inputs[idx - 3].select(); // 选中 break; default: break; } }else if(idx < 3){ switch (keyCode) { case 13: //回车键 inputs[idx + 3].focus(); // 设置焦点 inputs[idx + 3].select(); // 选中 break; case 40: //↓ inputs[idx + 3].focus(); // 设置焦点 inputs[idx + 3].select(); // 选中 break; default: break; } }else{ switch (keyCode) { case 13: //回车键 inputs[idx + 3].focus(); // 设置焦点 inputs[idx + 3].select(); // 选中 break; case 37: //← inputs[idx - 1].focus(); // 设置焦点 inputs[idx - 1].select(); // 选中 break; case 38: //↑ inputs[idx - 3].focus(); // 设置焦点 inputs[idx - 3].select(); // 选中 break; case 39: //→ inputs[idx +1].focus(); // 设置焦点 inputs[idx +1].select(); // 选中 break; case 40: //↓ inputs[idx + 3].focus(); // 设置焦点 inputs[idx + 3].select(); // 选中 break; default: break; } } return true; }
相关文章推荐
- 既然有了点方法为啥还要用valueForKey
- 【学习笔记】NGUI中为Popup Menu添加点击事件响应
- 2016-01-07 UIToolbar
- 老李分享:接电话之uiautomator 2
- UITableViewCell的选中颜色修改
- 老李分享:接电话之uiautomator 1
- 操作和操作队列 NSOperation和NSOperationQueue
- configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.
- pillow jpeg is required unless explicitly disabled using --disable-jpeg
- UI组件之TextView及其子类
- ios错误ignoring file xxx missing required architecture x86_64 in file
- java使用soapui解析wsdl
- IOS UITextview实现聊天表情输入框
- Android跑马灯Marquee
- 182,UIButton继承UIControl,UIControl中常用的属性和方法
- Photos(PHAssetCollectionChangeRequest)
- Photos(PHCollectionListChangeRequest)
- IEnumerable和IQueryable的区别
- 用Zoho Recruit轻松发面试反馈
- Qt 5入门指南之Qt Quick编程示例