views:

307

answers:

1

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?

+1  A: 

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.

brynk
+1 - it does work
Omeoe