使用 Opera Mobile 10 扫描输入

发布于 2024-11-02 22:11:41 字数 901 浏览 1 评论 0原文

我们为一款 PDA 应用程序选择了 Opera Mobile,一切都很顺利,直到我们在将扫描输入输入到其中一个文本字段时遇到了问题。

解决此问题的一般方法是在执行扫描操作时将一个文本框设置为具有焦点。

不幸的是,Opera 有意无意地不支持这一点。当您进入屏幕时,焦点不存在,并且无法明确设置它。接下来最糟糕的是,您也无法检测到按键事件,这使得几乎不可能从扫描操作中获取输入事件。

我不知道为什么 Opera 这个最受好评的移动浏览器不支持这个。

这些地方一遍又一遍地问同样的问题,

http://dev.opera。 com/forums/topic/255066

http://dev.opera.com/forums/topic/650332

http://dev.opera.com/forums/topic/384311

我们也在 Opera Dev 论坛上发帖,似乎他们(到目前为止)没有解决这个问题。如果有人尝试过解决方法,我们将有兴趣听到解决方案。

请注意,此处中的解决方案在 Opera Mobile 中不起作用10.我没有在建议的9.X版本中尝试过。

We have chosen the Opera Mobile for one PDA application, everything went well until we hit a problem with regards to taking a scanned input to one of the text fields.

The general way you'd approach this problem is by setting one textBox to have focus when the scan operation is performed.

UNFORTUNATELY, intentionally or unintentionally Opera is not supporting this. The focus is no-where when you enter in to the screen and there is no way of explicitely setting it. Worst comes next, you cannot detect the key-press events too, which makes it virtually impossible to take the input event from the scan operation.

I have no clue why Opera, one of the best acclaimed mobile browsers, does not support this.

These are the places the same question is asked over and over again,

http://dev.opera.com/forums/topic/255066

http://dev.opera.com/forums/topic/650332

http://dev.opera.com/forums/topic/384311

We have posted in the Opera Dev forum as well and it seems that they (so far) have no solution for this. If anyone has tried a workaround, we would be interested to hear the solution.

And please note that the solution in here is not working in Opera Mobile 10. I have not tried it in the proposed 9.X version.

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

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

发布评论

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

评论(1

梦里南柯 2024-11-09 22:11:41

我自己找到的。下面是如何做到这一点。

在表单中有一个隐藏按钮

输入类型=“按钮”
id='myHiddenButton'visible='false'
onclick="javascript:doFocus();"
width='1px' style="display:none"

有一个 JavaScript 在隐藏按钮的点击事件上被触发。

 函数 doFocus() {
         var focusElementId =“MyTextBox”
         var textBox = document.getElementById(focusElementId);
         textBox.focus();
     }

使用文档末尾的 javascript 单击按钮

 function clickButton() {
         document.getElementById('myHiddenButton').click();
     }

     setTimeout("clickButton()", 100);

I found it myself. And here is how to do it.

Have a hidden button in the form

input type="button"
id='myHiddenButton' visible='false'
onclick="javascript:doFocus();"
width='1px' style="display:none"

Have a javascript to get fired on the click event of the hidden button.

     function doFocus() {
         var focusElementId = "MyTextBox"
         var textBox = document.getElementById(focusElementId);
         textBox.focus();
     }

Have the button clicked using a javascript at the end of the document

     function clickButton() {
         document.getElementById('myHiddenButton').click();
     }

     setTimeout("clickButton()", 100);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文