javascript:捕获功能 (f1-12) 键

发布于 2024-11-27 12:04:18 字数 339 浏览 2 评论 0原文

可能的重复:
处理按键事件 (F1- F12)使用JavaScript和jQuery,跨浏览器

我正在努力用 Web 应用程序替换旧的 vb6 应用程序。在旧应用程序中,保存按钮链接到 f8,该应用程序的用户希望保持不变。如何捕获 f8 按钮以便将其链接到我的保存按钮?谢谢

Possible Duplicate:
Handling key-press events (F1-F12) using JavaScript and jQuery, cross-browser

I am working to replace an old vb6 app with a web app. in the old app the save button was linked to f8 and the users of this application want that to stay the same. How can i capture the f8 button so that it is linked to my save button? Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

听你说爱我 2024-12-04 12:04:18

您应该能够绑定到“keyup”事件并查看 keyCode。以下是您需要的键码列表。

http://www.cambiaresearch.com/c4/702b8cd1-e5b0-42e6-83ac-25f0306e3e25/javascript-char-codes-key-codes.aspx

YOu should be able to bind to the 'keyup' event and look at the keyCode. Here is a list of the keycodes you will need.

http://www.cambiaresearch.com/c4/702b8cd1-e5b0-42e6-83ac-25f0306e3e25/javascript-char-codes-key-codes.aspx

回忆那么伤 2024-12-04 12:04:18

DOM_VK_F8 = 119,因此您应该检查 keypress 事件侦听器的事件对象的 keyCode 属性是否等于 119。

addEventListener('keypress', function(e) {
    if (e.keyCode == 119)
        ; // do stuff here
}, false);

DOM_VK_F8 = 119, so you should check to see that the keypress event listener's event object's keyCode property is equal to 119.

addEventListener('keypress', function(e) {
    if (e.keyCode == 119)
        ; // do stuff here
}, false);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文