Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Intercept Key events in a Black Berry with JavaScript

Posted on 2009-07-03
3
Medium Priority
?
257 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

718 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