ahe*_*ick 1 jquery hotkeys keyboard-events
我在这里有一个非常基本的例子:http://jsfiddle.net/arhVd/1/
<form>
<input type="text">
<input type="submit">
</form>
$(function () {
$(document).keydown(function(e) {
e.preventDefault();
$('form').submit();
});
});
Run Code Online (Sandbox Code Playgroud)
我想确保在按F4时它没有内置的浏览器功能(在F4的情况下设置焦点到URL栏.或者可能F3显示'查找'栏.)提交表单的功能仍然有效,我只是不希望浏览器功能妨碍.
这是一个内部应用程序,功能键应该在其中运行应用程序中的HotKeys.
这似乎适用于IE8中的F3:
$(document).keydown(function(event) {
event.preventDefault();
if (event.keyCode == 114) { // F3
// Remap F3 to some other key that the browser doesn't care about
event.originalEvent.keyCode = 0;
}
};
Run Code Online (Sandbox Code Playgroud)
(基于http://www.fixya.com/support/t218276-disable_f3_function_key_from_intenet)
| 归档时间: |
|
| 查看次数: |
7351 次 |
| 最近记录: |