Current location: Hot Scripts Forums » General Web Coding » JavaScript » Trapping for CTRL-P, CTRL-BackSpace, etc


Trapping for CTRL-P, CTRL-BackSpace, etc

Reply
  #1 (permalink)  
Old 09-26-06, 08:04 AM
bashforth bashforth is offline
New Member
 
Join Date: Sep 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Trapping for CTRL-P, CTRL-BackSpace, etc

Hi .. I am looking for a way to trap for specific keystrokes such as CTRL-P, CTRL-Backspace, etc. I need to be able to trap for these whether or not the user is in a textbox/textarea or simply has the browser window open on our page. I know I can trap for chars and ASCII codes, but how do I trap for CTRL and other extended keystrokes?

Your help is appreciated!
Reply With Quote
  #2 (permalink)  
Old 09-26-06, 12:48 PM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
Try looking at this page on QuirksMode.
http://www.quirksmode.org/js/events_properties.html
It discusses events such as onkeydown etc, and there's also info about what each browser supports.

If I'm not mistaken, there's a special event property available which you can use to detect which "modifier" keys were pressed when an event fired.
__________________
[W3Schools - learn all about the standards.] [QuirksMode - Browser Quirks] [MS's Online Reference Docs] [DOM in Gecko.]
Please pay attention to stickys, announcements and forum rules, thank you.
Please also remember Code Wrappers and [SOLVED] Marking, this helps everyone.
Reply With Quote
  #3 (permalink)  
Old 10-08-06, 04:11 PM
Shaffer Shaffer is offline
Wannabe Coder
 
Join Date: Sep 2006
Location: Israel
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
http://bur.st/~sacha/
This is a basic example of what you need. I did this with a friend.
Just replace the code with with the correct key-codes, which the link above should probably teach you about, and change it a bit so that the function will produce only key-combinations accordingly.

Glad to potensually help,
Shaffer.
__________________
Hello from Israel!
Reply With Quote
  #4 (permalink)  
Old 10-10-06, 03:25 PM
bashforth bashforth is offline
New Member
 
Join Date: Sep 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks to the both of you

for your responses. I will continue to test.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 11:20 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.