2014年5月8日木曜日

WEB画面全体でのファンクションキーの制御


(function($) {

//全体のキーイベント制御
$(document).keydown ( function(event) {

switch (event.keyCode){
case 112:
// F1
if ( typeof(Xapl.fn.F1event)  === 'function'){
Xapl.fn.F1event();
}
return false;
case 113:
// F2
if ( typeof(Xapl.fn.F2event)  === 'function'){
Xapl.fn.F2event();
}
return false;
case 114:
// F3
if ( typeof(Xapl.fn.F3event)  === 'function'){
Xapl.fn.F3event();
}
return false;
case 115:
// F4
if ( typeof(Xapl.fn.F4event)  === 'function'){
Xapl.fn.F4event();
}
return false;
case 8:
//backspaceを無効にする
var tag = event.target.nodeName.toLowerCase();
var $target = $(event.target);
if ((tag !== 'input' && tag !== 'textarea') || $target.attr('readonly') || $target.is(':disabled')) {
return false;
}
}
return true;

});
})(jQuery);

0 件のコメント:

コメントを投稿