Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Event Listener - problem listening to key combinations

Reply
Thread Tools

Event Listener - problem listening to key combinations

 
 
carlos
Guest
Posts: n/a
 
      02-15-2008
The below code listens to key combinations in my app. I am using
prototype (not my decision), but I am open to using other
alternatives. The problem i'm having is that when using Event.observe
to listen for key combinations it doesn't always catch my key strokes.
If I press on one of the tabs in my app, it listens again. These tabs
represent the content pages in my app, which are dynamically
generated, and are iframe elements. I believe that has
somethign to do with it, but i'm not familiar with prototype or the
Event Model all that much. Any help would be appreciated! See my code
example below.

Event.observe(window, 'load', function() {
Event.observe(document, 'keypress', function(e){


//listen for key events
var targ = e ? e : window.event;
key = targ.keyCode ? targ.keyCode : targ.charCode;


//handle combination
if(targ.altKey == true && (key == 67)) {
HandleEvent(key);
}


});


 
Reply With Quote
 
 
 
 
Paul Wilkins
Guest
Posts: n/a
 
      02-16-2008
On Feb 16, 6:26 am, carlos <(E-Mail Removed)> wrote:
> i'm not familiar with prototype or the
> Event Model all that much. Any help would be appreciated!


http://roberthanson.blogspot.com/200...ejs-event.html
 
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
Event listener problem barry_normal Javascript 7 02-24-2011 05:53 PM
having trouble with event listener: detect iframe close event fromparent Mike Scirocco Javascript 4 04-05-2007 03:19 AM
Interruptions in live news listening Realone Player listening Thaqalain Computer Support 6 07-16-2005 02:11 PM
how to add double key listener SaintSpeak Java 1 12-23-2004 11:34 PM
Java Event Listener integer problem. Mmm_moo_cows Java 4 10-26-2004 03:26 PM



Advertisments