使用Opera Mobile 10扫描输入 [英] Scan inputs with Opera Mobile 10

查看:56
本文介绍了使用Opera Mobile 10扫描输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们为一个PDA应用程序选择了Opera Mobile,一切顺利,直到遇到扫描文本输入到一个文本字段的问题为止.

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.

不幸的是,Opera有意或无意地不支持此功能.当您进入屏幕时,焦点无处不在,无法明确设置它.接下来最糟糕的是,您也无法检测到按键事件,这实际上使从扫描操作中获取输入事件成为不可能.

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.

我不知道为什么Opera(最受好评的移动浏览器之一)不支持此功能.

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

我们也已经在Opera Dev论坛上发布了,看来他们(到目前为止)对此没有解决方案.如果有人尝试了解决方法,我们将很高兴听到解决方案.

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.

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

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.

推荐答案

我自己找到了它.这是如何做到的.

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"

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

具有一个可在隐藏按钮的click事件上触发的JavaScript.

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();
     }

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

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

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

     setTimeout("clickButton()", 100);

这篇关于使用Opera Mobile 10扫描输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆