• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 259
  • Last Modified:

Intercept Key events in a Black Berry with JavaScript

I'm trying to intercept key events using javascript.

In my script im getting the unicode like this:

 

 var unicode=evtobj.charCode? evtobj.charCode : evtobj.keyCode

 

and validating it with a IF statement for  example:

 

   if (unicode==50)
                       
                                     
                  do something ...                

                   
                Although in PC browsers this works  fine in the BlackBerry doesn't ... I have tried in Nokia and LG phones and works perfectly, Is there  another way to do this? because i can figure out that BlackBerry doesn't support these kind of instructions...
0
Veljean
Asked:
Veljean
  • 2
1 Solution
 
b0lsc0ttIT ManagerCommented:
Veljean,

Have you verified Javascript works?  Add an alert or some script to the event to see if it even exists.  If it does then you might try ...

var unicode=evtobj.charCode? evtobj.charCode : (evtobj.keyCode)? evtobj.keyCode : evtobj.which;

Let me know if you have any questions or need more information.

b0lsc0tt
0
 
VeljeanAuthor Commented:
Yes b0Isc0tt , the option  "JS enabled"  is already checked in my BlackBerry  , and I added an alert to the event to see what happens without success, like I said in a nomal PC browser and other cellphones (not blackberry) the script works perfectly. I will try your statement as soon as I can (unfortunately today I have run into  other issues that make impossible to test it) I hope we can keep us in touch...
0
 
b0lsc0ttIT ManagerCommented:
Let me know how that line works but the issue may still be general javascript support.  If you tried the alert and it didn't work then that is a sign Javascript isn't working or has very limited support.  The code below in the snippet would be good to use as a test (place it in between the body tags somewhere).  Let me know what you get by testing the line below.
bol

<script type="javascript">
document.write "This is a test line.<br>";
</script>

Open in new window

0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now