📜 ⬆️ ⬇️

focus in Opera Mobile 9.5 for Pocket PC

The task is very specific, it appears only if you are developing a web application for PDAs.

My friend suggested it to me. He implemented the collection of information on the stock balance using scanners. Those. special devices running Windows Mobile with reading the code code, connected via WiFi to the server where the product range is stored. It was implemented as a web application, thin, but not very client - Opera. One of the tasks is to save the time of workers working with the interface and minimize or completely remove repetitive routine operations. The task is to automatically transfer the focus to the inputs.

It turned out that the Opera focus method for input does not work as expected - when calling this method for input KEY_DOWN, this element is not caught.
')

The solution turned out to be simple and found rather by chance. It turned out that focus works correctly for textarea. Where necessary, textarea can bring css to the same form as input.

Working example code:

< html > < body > < form > < textarea name ="title" id ="title" > sample </ textarea > < strong ></ strong > </ form > </ body > < script > window.focus(); var v = document .getElementById( 'title' ); v.onfocus = function () { document .getElementsByTagName( 'strong' )[0].innerHTML = 'Yes!!' ; } v.select(); v.focus(); </ script > </ html > * This source code was highlighted with Source Code Highlighter .
  1. < html > < body > < form > < textarea name ="title" id ="title" > sample </ textarea > < strong ></ strong > </ form > </ body > < script > window.focus(); var v = document .getElementById( 'title' ); v.onfocus = function () { document .getElementsByTagName( 'strong' )[0].innerHTML = 'Yes!!' ; } v.select(); v.focus(); </ script > </ html > * This source code was highlighted with Source Code Highlighter .
  2. < html > < body > < form > < textarea name ="title" id ="title" > sample </ textarea > < strong ></ strong > </ form > </ body > < script > window.focus(); var v = document .getElementById( 'title' ); v.onfocus = function () { document .getElementsByTagName( 'strong' )[0].innerHTML = 'Yes!!' ; } v.select(); v.focus(); </ script > </ html > * This source code was highlighted with Source Code Highlighter .
  3. < html > < body > < form > < textarea name ="title" id ="title" > sample </ textarea > < strong ></ strong > </ form > </ body > < script > window.focus(); var v = document .getElementById( 'title' ); v.onfocus = function () { document .getElementsByTagName( 'strong' )[0].innerHTML = 'Yes!!' ; } v.select(); v.focus(); </ script > </ html > * This source code was highlighted with Source Code Highlighter .
  4. < html > < body > < form > < textarea name ="title" id ="title" > sample </ textarea > < strong ></ strong > </ form > </ body > < script > window.focus(); var v = document .getElementById( 'title' ); v.onfocus = function () { document .getElementsByTagName( 'strong' )[0].innerHTML = 'Yes!!' ; } v.select(); v.focus(); </ script > </ html > * This source code was highlighted with Source Code Highlighter .
  5. < html > < body > < form > < textarea name ="title" id ="title" > sample </ textarea > < strong ></ strong > </ form > </ body > < script > window.focus(); var v = document .getElementById( 'title' ); v.onfocus = function () { document .getElementsByTagName( 'strong' )[0].innerHTML = 'Yes!!' ; } v.select(); v.focus(); </ script > </ html > * This source code was highlighted with Source Code Highlighter .
  6. < html > < body > < form > < textarea name ="title" id ="title" > sample </ textarea > < strong ></ strong > </ form > </ body > < script > window.focus(); var v = document .getElementById( 'title' ); v.onfocus = function () { document .getElementsByTagName( 'strong' )[0].innerHTML = 'Yes!!' ; } v.select(); v.focus(); </ script > </ html > * This source code was highlighted with Source Code Highlighter .
  7. < html > < body > < form > < textarea name ="title" id ="title" > sample </ textarea > < strong ></ strong > </ form > </ body > < script > window.focus(); var v = document .getElementById( 'title' ); v.onfocus = function () { document .getElementsByTagName( 'strong' )[0].innerHTML = 'Yes!!' ; } v.select(); v.focus(); </ script > </ html > * This source code was highlighted with Source Code Highlighter .
  8. < html > < body > < form > < textarea name ="title" id ="title" > sample </ textarea > < strong ></ strong > </ form > </ body > < script > window.focus(); var v = document .getElementById( 'title' ); v.onfocus = function () { document .getElementsByTagName( 'strong' )[0].innerHTML = 'Yes!!' ; } v.select(); v.focus(); </ script > </ html > * This source code was highlighted with Source Code Highlighter .
  9. < html > < body > < form > < textarea name ="title" id ="title" > sample </ textarea > < strong ></ strong > </ form > </ body > < script > window.focus(); var v = document .getElementById( 'title' ); v.onfocus = function () { document .getElementsByTagName( 'strong' )[0].innerHTML = 'Yes!!' ; } v.select(); v.focus(); </ script > </ html > * This source code was highlighted with Source Code Highlighter .
  10. < html > < body > < form > < textarea name ="title" id ="title" > sample </ textarea > < strong ></ strong > </ form > </ body > < script > window.focus(); var v = document .getElementById( 'title' ); v.onfocus = function () { document .getElementsByTagName( 'strong' )[0].innerHTML = 'Yes!!' ; } v.select(); v.focus(); </ script > </ html > * This source code was highlighted with Source Code Highlighter .
  11. < html > < body > < form > < textarea name ="title" id ="title" > sample </ textarea > < strong ></ strong > </ form > </ body > < script > window.focus(); var v = document .getElementById( 'title' ); v.onfocus = function () { document .getElementsByTagName( 'strong' )[0].innerHTML = 'Yes!!' ; } v.select(); v.focus(); </ script > </ html > * This source code was highlighted with Source Code Highlighter .
  12. < html > < body > < form > < textarea name ="title" id ="title" > sample </ textarea > < strong ></ strong > </ form > </ body > < script > window.focus(); var v = document .getElementById( 'title' ); v.onfocus = function () { document .getElementsByTagName( 'strong' )[0].innerHTML = 'Yes!!' ; } v.select(); v.focus(); </ script > </ html > * This source code was highlighted with Source Code Highlighter .
  13. < html > < body > < form > < textarea name ="title" id ="title" > sample </ textarea > < strong ></ strong > </ form > </ body > < script > window.focus(); var v = document .getElementById( 'title' ); v.onfocus = function () { document .getElementsByTagName( 'strong' )[0].innerHTML = 'Yes!!' ; } v.select(); v.focus(); </ script > </ html > * This source code was highlighted with Source Code Highlighter .
  14. < html > < body > < form > < textarea name ="title" id ="title" > sample </ textarea > < strong ></ strong > </ form > </ body > < script > window.focus(); var v = document .getElementById( 'title' ); v.onfocus = function () { document .getElementsByTagName( 'strong' )[0].innerHTML = 'Yes!!' ; } v.select(); v.focus(); </ script > </ html > * This source code was highlighted with Source Code Highlighter .
  15. < html > < body > < form > < textarea name ="title" id ="title" > sample </ textarea > < strong ></ strong > </ form > </ body > < script > window.focus(); var v = document .getElementById( 'title' ); v.onfocus = function () { document .getElementsByTagName( 'strong' )[0].innerHTML = 'Yes!!' ; } v.select(); v.focus(); </ script > </ html > * This source code was highlighted with Source Code Highlighter .
  16. < html > < body > < form > < textarea name ="title" id ="title" > sample </ textarea > < strong ></ strong > </ form > </ body > < script > window.focus(); var v = document .getElementById( 'title' ); v.onfocus = function () { document .getElementsByTagName( 'strong' )[0].innerHTML = 'Yes!!' ; } v.select(); v.focus(); </ script > </ html > * This source code was highlighted with Source Code Highlighter .
  17. < html > < body > < form > < textarea name ="title" id ="title" > sample </ textarea > < strong ></ strong > </ form > </ body > < script > window.focus(); var v = document .getElementById( 'title' ); v.onfocus = function () { document .getElementsByTagName( 'strong' )[0].innerHTML = 'Yes!!' ; } v.select(); v.focus(); </ script > </ html > * This source code was highlighted with Source Code Highlighter .
  18. < html > < body > < form > < textarea name ="title" id ="title" > sample </ textarea > < strong ></ strong > </ form > </ body > < script > window.focus(); var v = document .getElementById( 'title' ); v.onfocus = function () { document .getElementsByTagName( 'strong' )[0].innerHTML = 'Yes!!' ; } v.select(); v.focus(); </ script > </ html > * This source code was highlighted with Source Code Highlighter .
< html > < body > < form > < textarea name ="title" id ="title" > sample </ textarea > < strong ></ strong > </ form > </ body > < script > window.focus(); var v = document .getElementById( 'title' ); v.onfocus = function () { document .getElementsByTagName( 'strong' )[0].innerHTML = 'Yes!!' ; } v.select(); v.focus(); </ script > </ html > * This source code was highlighted with Source Code Highlighter .

Source: https://habr.com/ru/post/49382/


All Articles