ITeye博客

把Tab键全部转换成Enter(回车)键

foxpro · 2009-07-29 17:00 · ExtJs · Markdown

var run = function() { var all = Ext.query('input'); Ext.each(all, function(o, i, all) { Ext.get(o).addKeyMap({ key : 13, fn : function() { try { all.focus() } catch (e) { event.keyCode = 9 } if (all && /button|reset|submit/.test(all.type)) all.click();

                    return true;
                }
            })
        });
Ext.getBody().focus(); 

try {
    var el;
    if (typeof eval(xFocus) == 'object') { 
        el = Ext.getDom(xFocus).tagName == 'input'
                ? Ext.getDom(xFocus)
                : Ext.get(xFocus).first('input', true); 
    } else {
        el = all; 
    }
    el.focus();
} catch (e) {
}

} Ext.isReady ? run() : Ext.onReady(run);

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。