Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 258
  • 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
 
b0lsc0ttCommented:
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
 
b0lsc0ttCommented:
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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