Opera Mobile 9.7 Beta 集焦点
我们使用手持式扫描仪将物品移入和移出库存。扫描仪运行一个 ASP 页,该页提交移动项目的表单。我们最近购买了一台运行 Windows Mobile 6.1 的新扫描仪,很快就意识到 Mobile IE 完全没用。它不能正确渲染表格,更糟糕的是,它不能识别 onblur、onkeypress 和许多其他常见的 javascript 函数。
我们测试了许多移动浏览器,发现 Opera Mobile 9.7 运行良好,除了在页面加载时将焦点设置在输入文本字段上之外。该页面有许多文本字段,并将表单提交回自身进行处理。一旦扫描了一个字段(或在键盘上输入),表单就会自行提交,处理输入并启用表单上的下一个字段。在标记的末尾,调用 select() 和 focus() 来选择字段中的任何文本并设置焦点,以便用户所要做的就是扫描该值。这是页面末尾的 javascript 的样子。
document.forms["frm1"].elements["txt1"].select(); document.forms["frm1"].elements["txt1"].focus();
有什么方法可以将焦点集中在 Opera Mobile 9.7 上吗?
We use a handheld scanner to move items in and out of inventory. The scanner runs an ASP page that submits the form to move the item. We recently purchased a new scanner running Windows Mobile 6.1 and soon realized that Mobile IE is completely useless. It does not render tables correctly and worse, it doesn't recognize onblur, onkeypress and many other common javascript functions.
We tested out many mobile browsers and found that Opera Mobile 9.7 works great except for setting the focus on an input text field when the page loads. The page has many text fields that and submits the form back to itself for processing. Once one field is scanned (or entered on the keyboard), the form submits itself, process the input and enables the next field on the form. At the end of the markup, select() and focus() are called to select any text in the field and to set focus so all the user has to do is scan the value. Here is what the javascript looks like at the end of the page.
document.forms["frm1"].elements["txt1"].select();
document.forms["frm1"].elements["txt1"].focus();
Is there any way to set focus on Opera Mobile 9.7?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在 Opera 9.7 中对输入字段使用自动对焦,如下所示:
<输入类型=“文本”自动对焦/>
然而,这似乎只在第一次加载时有效,提交表单后,该字段再次失去焦点。如果您找到解决方案,请告诉我。
You can use autofocus for the input field in Opera 9.7 like this:
<input type="text" autofocus />
However, that only seems to work on the first load, after submitting the form the field loses focus again. Please let me know if you find a solution.