Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > IEMobile and event.keyCode

Reply
Thread Tools

IEMobile and event.keyCode

 
 
Larry Newnam
Guest
Posts: n/a
 
      01-10-2008
Goal: My user will have an RF gun (scan gun with keys) running a
simple app in IEMobile. I need to know when they press a function key
(like F.

This does not work for me:
document.onkeydown = function getcode(ev) {
value = (window.external) ? event.keyCode : ev.keyCode;
alert(value);
}

Does anyone know of an alternative way to capture the event in
IEMobile?

Expect lavish praise if you can figure this out - that's all I can
offer really.
 
Reply With Quote
 
 
 
 
Henry
Guest
Posts: n/a
 
      01-10-2008
On Jan 10, 4:16 pm, Larry Newnam wrote:
> Goal: My user will have an RF gun (scan gun with keys)
> running a simple app in IEMobile. I need to know when
> they press a function key
> (like F.
>
> This does not work for me:
> document.onkeydown = function getcode(ev) {
> value = (window.external) ? event.keyCode : ev.keyCode;

^^^^^^^^^^^^^^^
Why the insane object inference? What is the relationship you are
proposing between whether the browser's window object has an -
external - property with trueness and the handling of event objects?

> alert(value);
>
> }
>
> Does anyone know of an alternative way to capture the event in
> IEMobile?
>
> Expect lavish praise if you can figure this out - that's all I can
> offer really.


The odds are pretty good that your IE mobile browser does not have a -
window.external - object and that silly inference alone is your
problem. The normal cross browser handling for event objects is to
normalize the event object (function parameter vs. global event
reference) with:-

ev = ev || window.event;

- and then read the key code from that normalised object:-

value = ev.keyCode;

In the event that IE mobile does not provide a - keyCode - property
you might try looking up older alternatives. And also try other events
such as keypress and keyup.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
onchange event in IEMobile Daan Javascript 1 05-31-2008 02:24 PM
if and and vs if and,and titi VHDL 4 03-11-2007 05:23 AM
IEmobile test software B ASP .Net Mobile 0 05-29-2006 06:41 AM
IEMOBILE and javascript B ASP .Net Mobile 0 05-28-2006 10:13 PM



Advertisments