2 key actions – Casio Naurtech CETerm Ver.5.1 Web Browser Programming Manual User Manual

Page 11

Advertising
background image

N

AURTECH

W

EB

B

ROWSER

S

MART

C

LIENTS FOR

W

INDOWS

CE .NET / P

OCKET

PC




Web Browser Programming Guide

Page 11


function onscan(data, source, type, time, length)
{
if (length > 5)
{
document.form[0].barcode.value = data;
document.form[0].submit();
}
}
<\script>

2.2 K

EY

A

CTIONS

In many situations, a Web application will be written to make special use of the
keys on a handheld. The device may be used without a stylus or there may be
function keys (Fx) which the application uses to perform special actions. The
Naurtech Web Browser has several special features to make use of the hardware
keys. These features are especially important on Windows Mobile based
systems. The Windows Mobile browser does not have native support for special
key actions, but the Naurtech Web Browser overcomes this limitation.

The simplest way to assign a key to a special action is to use a special HTML
META tag. This will instruct the browser to execute a JavaScript method or
navigate to a pre-specified URL when the key is pressed:

<meta http-equiv="OnKey0x70" content="Javascript:onF1key();"><! F1>
...
<script language=javascript>
function onF1key()
{
// Clear entry
document.form[0].barcode.value = “”;
}
<\script>


or

<meta http-equiv="OnKey0x70" content="home.htm"><! F1>


It is important to know that the OnKey META tag acts as a “hotkey” and it will
activate the action even if the focus is in a text input element. If you assign an
action to a normal key such as ‘1’ then you will be unable to enter the ‘1’ as a
character anywhere on the page. Techniques are available to ignore the hotkey
action within text input elements.

Advertising