如何实现CTRL或SHIFT

如何实现CTRL或SHIFT

本文介绍了如何实现CTRL或SHIFT +< letter>的快捷键组合通过JavaScript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ASP.NET 2.0 Web应用程序,如何实现的快捷键组合,最好是通过JavaScript,使Web应用程序符合人体工程学更好?如何通过JavaScript捕获多键键盘事件?

ASP.NET 2.0 web application, how to implement shortcut key combination of , preferably through JavaScript, to make web application ergonomically better? How to capture multiple-key keyboard events through JavaScript?

推荐答案

简短的回答是你使用Javascript捕获 keydown 事件并使用该事件来触发一个函数。
相关文章:

The short answer is that you use Javascript to capture a keydown event and use that event to fire off a function.Relevant articles:






  • http://www.openjs.com/scripts/events/keyboard_shortcuts/
  • http://udayms.wordpress.com/2006/03/17/ajax-key-disabling-using-javascript/
  • http://protocolsofmatrix.blogspot.com/2007/09/javascript-keycode-reference-table-for.html
  • http://www.quirksmode.org/js/keys.html

如果你正在使用,我建议你你看一下跨浏览器的解决方案。

If you're using the jQuery library, I'd suggest you look at the HotKeys plugin for a cross-browser solution.

为什么?因为它可能会破坏可用性,而不是增加它。虽然人们普遍认为普通浏览器中没有使用一键快捷键(Opera将其从上一个主要版本中删除为默认值),但您无法弄清楚各种浏览器使用的组合键快捷键是什么,也不会是什么。 。

Why? Because it might break de the usability, instead of increasing it. While it's generally accepted that "one-key shortcut" are not used in common browsers (Opera remove it as default from its last major version), you cannot figure out what are, nor what will be, the key combination shortcuts used by various browser.


Gizmo说得好。有关常用accesskey分配的一些信息,请访问。

Gizmo makes a good point. There's some information about commonly-used accesskey assignments at http://www.clagnut.com/blog/193/.

如果您确实更改了访问键,这里有一些文章提供了很好的建议:

If you do change the accesskeys, here are some articles with good suggestions for how to do it well:




  • Accesskeys: Unlocking Hidden Navigation
  • Using accesskey attribute in HTML forms and links

你可能会发现非常有用(信息)。 。键盘快捷键 。

And you may find this page of Firefox's default Keyboard and Mouse Shortcuts useful (Another version of same information). Keyboard shortcuts for Internet Explorer 7 and Internet Explorer 6. Keyboard shortcuts for Opera and Safari.

您更有可能遇到或其他添加更多键盘快捷键的屏幕阅读器。

You're more likely to run into problems with JAWS or other screen readers that add more keyboard shortcuts.

这篇关于如何实现CTRL或SHIFT +< letter>的快捷键组合通过JavaScript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-28 00:10