惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
Microsoft Security Blog
Microsoft Security Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
V
Visual Studio Blog
宝玉的分享
宝玉的分享
IT之家
IT之家
人人都是产品经理
人人都是产品经理
T
The Blog of Author Tim Ferriss
I
InfoQ
B
Blog RSS Feed
T
Threatpost
博客园_首页
M
MIT News - Artificial intelligence
Spread Privacy
Spread Privacy
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Know Your Adversary
Know Your Adversary
U
Unit 42
Engineering at Meta
Engineering at Meta
C
Cyber Attacks, Cyber Crime and Cyber Security
月光博客
月光博客
Scott Helme
Scott Helme
T
Tor Project blog
有赞技术团队
有赞技术团队
AWS News Blog
AWS News Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Last Week in AI
Last Week in AI
S
Schneier on Security
Vercel News
Vercel News
博客园 - Franky
C
Cybersecurity and Infrastructure Security Agency CISA
L
LINUX DO - 热门话题
NISL@THU
NISL@THU
L
LangChain Blog
爱范儿
爱范儿
Google DeepMind News
Google DeepMind News
The GitHub Blog
The GitHub Blog
雷峰网
雷峰网
Latest news
Latest news
C
CXSECURITY Database RSS Feed - CXSecurity.com
Hugging Face - Blog
Hugging Face - Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
G
GRAHAM CLULEY
S
Security Affairs
A
About on SuperTechFans
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
大猫的无限游戏
大猫的无限游戏
W
WeLiveSecurity
Cisco Talos Blog
Cisco Talos Blog
罗磊的独立博客

博客园 - deerchao

Unity 在平面上播放含透明通道的视频(Play video with alpha channel on plane in unity) 域名迁移 错误721 -- 在虚拟机中连接VPN, 显示验证用户名和密码之后出错 - deerchao 繁体编码文本文件转换为简体编码的工具 生成VB多行字符串常量的工具 64位虚拟机Guest OS安装错误:0xC0000225 在64bit Win2008上运行Asp + Access网站 工具: 删除Visual Studio项目中文件链接,并把原文件复制到相应的目录 一个代表年月的类YearMonth Tip: Resharper 中 "Unknown Comment" 问题的解决办法 Struct与赋值 Tips 测试ConnectionString是否能连接上数据库服务器 奇怪的TreeView(WinForms)自动选中问题 From C# to VB MapPath的反函数(Reversing MapPath) A fast object clone class - using Expression.Compile() jQuery.combobox, 给文本框添加下拉选项的轻量级插件 CDTray, 打开,关闭光驱的系统托盘程序
jQuery.Excel, 使用Ctrl+方向键/Home/End在input表格中移动
deerchao · 2009-02-23 · via 博客园 - deerchao

Code
// Enable user to move focus in a grid of inputs with Ctrl + Up, Down, Left, Right, Home, End
//
 Could be called again after more rows are created.
//
 deerchao@gmail.com   2009-2-23

// usage:
//
--------------Html----------------
//
  <tr class="dataRow">
//
      <td><input /></td>
//
      <td><input /></td>
//
      <td><input /></td>
//
  </tr>
//
  <tr class="dataRow">
//
      <td><input /></td>
//
      <td><input /></td>
//
      <td><input /></td>
//
  </tr>
//
--------------Script-------------
//
 jQuery.excel('dataRow');

jQuery.extend({
    excel: 
function(rowClass) {
        
var keys = { left: 37, up: 38, right: 39, down: 40, home: 36, end: 35 };
        rowClass 
= rowClass ? rowClass : '.excel';
        
if (rowClass[0!= '.')
            rowClass 
= '.' + rowClass;

        $(rowClass).unbind('keyup',onkeyup).bind(

'keyup',onkeyup);function onkeyup(evt) {
            
var ctrlOnly = evt.ctrlKey && !evt.altKey && !evt.shiftKey;
            
switch (evt.keyCode) {
                
case keys.down:
                    go(
"down");
                    
break;
                
case keys.up:
                    go(
"up");
                    
break;
                
case keys.left:
                    
if (ctrlOnly)
                        go(
"left");
                    
break;
                
case keys.right:
                    
if (ctrlOnly)
                        go(
"right");
                    
break;
                
case keys.home:
                    
if (ctrlOnly)
                        go(
"home");
                    
break;
                
case keys.end:
                    
if (ctrlOnly)
                        go(
"end");
                    
break;
            }
function go(to) {
                
var td = $(evt.target).closest('td');
                
var tr = $(evt.currentTarget);
                
var toFocus = null;
                
switch (to) {
                    
case 'home':
                        toFocus 
= lastInput(td.prevAll('td'));
                        
break;
                    
case 'end':
                        toFocus 
= lastInput(td.nextAll('td'));
                        
break;
                    
case 'left':
                        toFocus 
= firstInput(td.prevAll('td'));
                        
if (!toFocus)
                            toFocus 
= lastInput(tr.prev('tr' + rowClass).children('td'));
                        
break;
                    
case 'right':
                        toFocus 
= firstInput(td.nextAll('td'));
                        
if (!toFocus)
                            toFocus 
= firstInput(tr.next('tr' + rowClass).children('td'));
                        
break;
                    
case 'up':
                        toFocus 
= firstInput(tr.prev('tr' + rowClass).children('td'), td.prevAll('td').size());
                        
break;
                    
case 'down':
                        toFocus 
= firstInput(tr.next('tr' + rowClass).children('td'), td.prevAll('td').size());
                        
break;
                }
                
if (toFocus) {
                    toFocus.focus();
                }
            }
function firstInput(tds, start) {
                
if (!start)
                    start 
= 0;
                
for (var i = start; i < tds.size(); i++) {
                    
var inputs = $(tds[i]).children('input, select, textarea');
                    
if (inputs.size())
                        
return inputs[0];
                }
                
return null;
            }
function lastInput(tds) {
                
for (var i = tds.size() - 1; i >= 0; i--) {
                    
var inputs = $(tds[i]).children('input, select, textarea');
                    
if (inputs.size())
                        
return inputs[0];
                }
                
return null;
            }
        }
    }
});