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

推荐订阅源

C
Cyber Attacks, Cyber Crime and Cyber Security
The Last Watchdog
The Last Watchdog
Forbes - Security
Forbes - Security
S
Security @ Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog
T
Troy Hunt's Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
W
WeLiveSecurity
WordPress大学
WordPress大学
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
N
News | PayPal Newsroom
D
DataBreaches.Net
博客园_首页
Y
Y Combinator Blog
F
Fortinet All Blogs
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research
T
Tailwind CSS Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Hugging Face - Blog
Hugging Face - Blog
The GitHub Blog
The GitHub Blog
B
Blog RSS Feed
C
CERT Recently Published Vulnerability Notes
P
Privacy & Cybersecurity Law Blog
Help Net Security
Help Net Security
S
SegmentFault 最新的问题
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
N
News and Events Feed by Topic
Schneier on Security
Schneier on Security
V
Vulnerabilities – Threatpost
A
About on SuperTechFans
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
L
LangChain Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
GbyAI
GbyAI
L
LINUX DO - 热门话题
Simon Willison's Weblog
Simon Willison's Weblog
雷峰网
雷峰网
G
Google Developers Blog
Cyberwarzone
Cyberwarzone
I
Intezer
Google DeepMind News
Google DeepMind News
AWS News Blog
AWS News Blog
C
Check Point Blog
AI
AI
博客园 - 【当耐特】
有赞技术团队
有赞技术团队
博客园 - 司徒正美

博客园 - 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;
            }
        }
    }
});