jquery的鍵盤事件修改代碼
更新時間:2011年02月24日 23:05:55 作者:
jquery的鍵盤事件修改代碼,需要的朋友可以參考下。
復制代碼 代碼如下:
(function($){
var no_ie_pr=function(e){
var _this=e;
var tabpr=function(e){
_this.attr('tabIndex', 1).click(function(){
_this.focus();
});
if(!$.browser.msie){
_this.css("outline-style", "none");
}
}
var gettag=_this[0].tagName.toLowerCase();
var oe=['abbr','acronym','address','b','bdo','big','blockquote','center','cite','dd','del','dir','dfn','dl','dt','em','font','form','h1','h2','h3','h4','h5','h6','i','ins','img','ins','kbd','li','menu','ol','p','pre','q','s','samp','small','strike','strong','sub','sup','th','tr','tt','u','ul','var'];
if($.inArray(gettag,oe)!=-1){
tabpr();
}else{
if ($.browser.msie) {
var ce=['span','div'];
if($.inArray(gettag,ce)!=-1){
//IE只對絕對定位元素和固定定位元素有效,加tabIndex無法消除虛線
}else{
var ce=['label','legend','tbody','tfoot','thead'];
if($.inArray(gettag,ce)!=-1){
tabpr();
}
}
}else{
var ce=['caption','fieldset','table','td','code','div','span','label','legend','tbody','tfoot','thead'];
if($.inArray(gettag,ce)!=-1){
tabpr();
}
}
}
}
$.fn.oldKeyup=$.fn.keyup;
$.fn.keyup=function(fn){
no_ie_pr(this);
$(this).oldKeyup(fn);
}
$.fn.oldKeypress=$.fn.keypress;
$.fn.keypress=function(fn){
no_ie_pr(this);
$(this).oldKeypress(fn);
}
$.fn.oldKeydown=$.fn.keydown;
$.fn.keydown=function(fn){
no_ie_pr(this);
$(this).oldKeydown(fn);
}
})(jQuery)
您可能感興趣的文章:
- js和jquery實現(xiàn)監(jiān)聽鍵盤事件示例代碼
- jQuery事件之鍵盤事件(ctrl+Enter回車鍵提交表單等)
- jquery 按鍵盤上的enter事件
- jquery.hotkeys監(jiān)聽鍵盤按下事件keydown插件
- jquery快捷動態(tài)綁定鍵盤事件的操作函數(shù)代碼
- jquery鍵盤事件使用介紹
- jquery鍵盤事件介紹
- jquery dialog鍵盤事件代碼
- jquery keypress,keyup,onpropertychange鍵盤事件
- 擴展jQuery 鍵盤事件的幾個基本方法
- jquery HotKeys輕松搞定鍵盤事件代碼
- jQuery簡單獲取鍵盤事件的方法
相關文章
jquery多行滾動/向左或向上滾動/響應鼠標實現(xiàn)思路及代碼
多行滾動jQuery循環(huán)新聞列表代碼包括以下功能:鼠標滑上焦點圖時停止自動播放/滑出時開始自動播放以及判斷執(zhí)行橫向或縱向滾動,感興趣的朋友可以了解下哦2013-01-01
詳解jQuery中的getAll()和cleanData()
這篇文章主要介紹了jQuery之getAll()和cleanData()函數(shù)的實例代碼解析,非常不錯,具有一定的參考借鑒價值,需要的朋友參考下吧2019-04-04
jQuery 遍歷- 關于closest() 的方法介紹以及與parents()的方法區(qū)別分析
本篇文章介紹了,jQuery 遍歷- 關于closest() 的方法介紹以及與parents()的方法區(qū)別分析。需要的朋友參考下2013-04-04

