Solved

Intercept Key events in a Black Berry with JavaScript

Posted on 2009-07-03
3
254 Views
Last Modified: 2012-05-07
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
Comment
Question by:Veljean
  • 2
3 Comments
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 24775451
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
 
LVL 1

Author Comment

by:Veljean
ID: 24786962
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
 
LVL 54

Accepted Solution

by:
b0lsc0tt earned 125 total points
ID: 24788519
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Google Maps API and PHP 25 48
Adding Row and Cell on a table 14 25
How can I make a javascript to show drop down 4 22
multiple selects 23 48
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question