如何从Zebra mc330m扫描仪捕获JavaScript窗口中的document [keypress]上的输入? [英] How to catch input on document[keypress] on window in javascript from Zebra mc330m scanner?
问题描述
我将扫描仪配置为在输入末尾发送Enter键,js会正确读取它,但其他字符丢失.
I configured the scanner to send Enter at the end of the input and js reads it correctly but the other characters are lost.
我尝试使用 event.keyCode,event.which,event.charCode 对输入字符进行解码,但没有任何效果.如果我将其附加到普通输入,则可以正常工作.它也可以在浏览器地址栏中(chrome)使用.但是,当我将其附加到文档['onkeypress']时,它不会读取字符.
I have tried to decode the input characters with event.keyCode, event.which, event.charCode and nothing works. If I attach it to normal input it works. It also works in the browser address bar (chrome). But when I attach it to the document['onkeypress'] it doesn't read the characters.
我从此处尝试了Martin Orth解决方案: https://developer.zebra.com/thread/35513但我无法使其正常工作,甚至不知道它是否是同一台扫描仪.
I tried Martin Orth solution from here: https://developer.zebra.com/thread/35513 but I couldn't make it work I even don't know if it's the same scanner.
从这里我了解到扫描仪正在发送ASCII字符,而javascript没有读取它们的机制? https://developer.zebra.com/thread/34536
From here I understood that the scanner is sending ASCII characters and javascript has no mechanizm to read them? https://developer.zebra.com/thread/34536
如果有人知道解决该问题的方法,将非常感谢您的帮助.如果可能的话,我更喜欢使用js/jquery.
If anyone knows the solution to this problem, help is highly appreciated. I prefer with js/jquery if it is possible at all.
推荐答案
此功能是使用按键功能最近添加到DataWedge 7.3中的,该功能包含在最新的MC33 OS更新(02.13.15-LG Update 16)中-我写道有关如何使用它的博客: https://developer.zebra.com/博客/listening-keypress-events-datawedge .为了清楚起见,我为Zebra工作
This feature, using keypress, was recently added to DataWedge 7.3 which is included in the latest MC33 OS update (02.13.15 - LG Update 16) - I wrote a blog about how to use it: https://developer.zebra.com/blog/listening-keypress-events-datawedge. For clarity, I work for Zebra
这篇关于如何从Zebra mc330m扫描仪捕获JavaScript窗口中的document [keypress]上的输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!