使用JavaScript进行强大的键盘快捷键处理 [英] Robust keyboard shortcut handling using JavaScript
问题描述
使用JavaScript为Web应用程序创建全局键盘快捷键处理程序的最强大的方法是什么,即我应该处理哪些事件以及应该将事件处理程序附加到什么位置?
What's the most robust way of creating a global keyboard shortcut handler for a Web application using JavaScript i.e. which event(s) should I handle and what should the event handler(s) be attached to?
我想要类似Gmail中的系统,可以处理单键按键快捷方式以及带修饰键的快捷方式,例如Ctrl + B等。代码必须在IE 6以及现代浏览器中运行。
I want something like the system in Gmail which can handle both single keypress shortcuts and also shortcuts with modifier keys e.g. Ctrl + B etc. The code has to work in IE 6 as well as modern browsers.
我可以使用Prototype框架而不是jQuery,所以请不要jQuery特定的答案!
I have the Prototype framework available to use but not jQuery, so please, no jQuery-specific answers!
推荐答案
LivePipe控件包中提供的HotKey库与Prototype一起使用,并且与IE兼容。
The HotKey library available in the LivePipe controls package works with Prototype and is IE compatible.
http://livepipe.net/extra/hotkey
这篇关于使用JavaScript进行强大的键盘快捷键处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!