<legend id='WhTuu'><style id='WhTuu'><dir id='WhTuu'><q id='WhTuu'></q></dir></style></legend>
    <tfoot id='WhTuu'></tfoot>
    1. <small id='WhTuu'></small><noframes id='WhTuu'>

      • <bdo id='WhTuu'></bdo><ul id='WhTuu'></ul>
      <i id='WhTuu'><tr id='WhTuu'><dt id='WhTuu'><q id='WhTuu'><span id='WhTuu'><b id='WhTuu'><form id='WhTuu'><ins id='WhTuu'></ins><ul id='WhTuu'></ul><sub id='WhTuu'></sub></form><legend id='WhTuu'></legend><bdo id='WhTuu'><pre id='WhTuu'><center id='WhTuu'></center></pre></bdo></b><th id='WhTuu'></th></span></q></dt></tr></i><div id='WhTuu'><tfoot id='WhTuu'></tfoot><dl id='WhTuu'><fieldset id='WhTuu'></fieldset></dl></div>

      如何使用 javascript 检测硬件键盘的存在?

      时间:2023-09-07

      • <bdo id='uaEy1'></bdo><ul id='uaEy1'></ul>

            <tbody id='uaEy1'></tbody>

            <i id='uaEy1'><tr id='uaEy1'><dt id='uaEy1'><q id='uaEy1'><span id='uaEy1'><b id='uaEy1'><form id='uaEy1'><ins id='uaEy1'></ins><ul id='uaEy1'></ul><sub id='uaEy1'></sub></form><legend id='uaEy1'></legend><bdo id='uaEy1'><pre id='uaEy1'><center id='uaEy1'></center></pre></bdo></b><th id='uaEy1'></th></span></q></dt></tr></i><div id='uaEy1'><tfoot id='uaEy1'></tfoot><dl id='uaEy1'><fieldset id='uaEy1'></fieldset></dl></div>
              <tfoot id='uaEy1'></tfoot><legend id='uaEy1'><style id='uaEy1'><dir id='uaEy1'><q id='uaEy1'></q></dir></style></legend>

            • <small id='uaEy1'></small><noframes id='uaEy1'>

              • 本文介绍了如何使用 javascript 检测硬件键盘的存在?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                使用 javascript 检测硬件键盘存在的最佳跨浏览器和跨平台方法是什么?

                What is the best cross-browser and cross-platform way to detect hardware keyboard presence with javascript?

                推荐答案

                这可能是一个老问题,但几个月前,我自己也在寻找解决方案.我正在构建一个消息传递系统,当有人在物理键盘上点击 Return 时应该发送消息,但当有人在虚拟键盘上点击 Return 时插入换行符.我解决它的方法是计算 keydownkeyup 事件之间的时间,并在 Return 被击中时获取平均值.

                This may be an old question, but a few months ago, I was looking for a solution to this myself. I was building a messaging system which should send the message when someone hits Return on their physical keyboard, but inserts a newline when someone hits Return on a virtual keyboard. The way I solved it was by counting the time between keydown and keyup events and getting the average when Return was hit.

                我终于开始在我的博客 这里.

                I finally got around to documenting it on my blog here.

                这篇关于如何使用 javascript 检测硬件键盘的存在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:在 HTML5 画布中创建关键事件的最佳方式是什么 下一篇:按向上箭头时防止文本输入中的默认行为

                相关文章

                最新文章

                <i id='Y5a4x'><tr id='Y5a4x'><dt id='Y5a4x'><q id='Y5a4x'><span id='Y5a4x'><b id='Y5a4x'><form id='Y5a4x'><ins id='Y5a4x'></ins><ul id='Y5a4x'></ul><sub id='Y5a4x'></sub></form><legend id='Y5a4x'></legend><bdo id='Y5a4x'><pre id='Y5a4x'><center id='Y5a4x'></center></pre></bdo></b><th id='Y5a4x'></th></span></q></dt></tr></i><div id='Y5a4x'><tfoot id='Y5a4x'></tfoot><dl id='Y5a4x'><fieldset id='Y5a4x'></fieldset></dl></div>
              • <tfoot id='Y5a4x'></tfoot>
              • <legend id='Y5a4x'><style id='Y5a4x'><dir id='Y5a4x'><q id='Y5a4x'></q></dir></style></legend>
                  <bdo id='Y5a4x'></bdo><ul id='Y5a4x'></ul>

              • <small id='Y5a4x'></small><noframes id='Y5a4x'>