Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Oct 2007
Posts: 39
Reputation: Tom Tolleson is an unknown quantity at this point 
Solved Threads: 0
Tom Tolleson's Avatar
Tom Tolleson Tom Tolleson is offline Offline
Light Poster

Ctrl+t?

 
0
  #1
Feb 15th, 2008
Hi! I'm working on a graphics interface that is almost completely JavaScript. I want to assign a key combination to a function. For example: if the user hits Control+T, a new window would pop open.

Any tips?

Thanks!

Tom Tolleson
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 483
Reputation: DangerDev has a spectacular aura about DangerDev has a spectacular aura about 
Solved Threads: 58
DangerDev's Avatar
DangerDev DangerDev is offline Offline
Posting Pro in Training

Re: Ctrl+t?

 
0
  #2
Feb 16th, 2008
Freedom in the Mind, Faith in the words.. Pride in our Souls...
Indian Developer
http://falaque.wordpress.com/
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 39
Reputation: Tom Tolleson is an unknown quantity at this point 
Solved Threads: 0
Tom Tolleson's Avatar
Tom Tolleson Tom Tolleson is offline Offline
Light Poster

Re: Ctrl+t?

 
0
  #3
Feb 19th, 2008
That seems to work for when the user presses any key. What I'm going for is a specific event that is a combination of the CTRL key with the letter T.

Here's what I have so far:

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1.  
  2. function doSomething() {
  3. // The function code goes here
  4. }
  5.  
  6.  
  7.  
  8. event.ctrlKey("t") {
  9. doSomething;
  10. }

I'm just not sure how to express the combination of the CTRL press and the letter T press together.

Thanks!
Last edited by Tom Tolleson; Feb 19th, 2008 at 4:36 pm.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 483
Reputation: DangerDev has a spectacular aura about DangerDev has a spectacular aura about 
Solved Threads: 58
DangerDev's Avatar
DangerDev DangerDev is offline Offline
Posting Pro in Training

Re: Ctrl+t?

 
0
  #4
Feb 20th, 2008
Hi
evenif u will acheive this you will have problem, coz browser will also do some function in this case, like Mozilla will start new tab.
so try some thing else.
Why you want to do this, probably we can suggest some thing different.
Freedom in the Mind, Faith in the words.. Pride in our Souls...
Indian Developer
http://falaque.wordpress.com/
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 39
Reputation: Tom Tolleson is an unknown quantity at this point 
Solved Threads: 0
Tom Tolleson's Avatar
Tom Tolleson Tom Tolleson is offline Offline
Light Poster

Re: Ctrl+t?

 
0
  #5
Feb 20th, 2008
Thanks for the reply.

I'm making this for an internal website (intranet) and it only needs to work in Internet Explorer.

I want the user to be able to pull up a pop-up window in which to write. But I cannot have a button on the webpage to activate it. I have to follow a strict design guideline.

Thanks again!
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 483
Reputation: DangerDev has a spectacular aura about DangerDev has a spectacular aura about 
Solved Threads: 58
DangerDev's Avatar
DangerDev DangerDev is offline Offline
Posting Pro in Training

Re: Ctrl+t?

 
0
  #6
Feb 21st, 2008
it only needs to work in Internet Explorer.
it has solve your problem,
when you will press ctrl+t(or any other combination) it will return you perticular keyCode using which you can identify the key combination.
in IE you can capture keyCode using window.event.keyCode
use document.onkeypress to capture keypress event on whole document.
see this also.
hope this will solve your problem.

following example may help you:
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. document.onkeypress=function()
  5. {
  6.  
  7. alert(window.event.keyCode);
  8.  
  9. }
  10. </script>
  11. </head>
  12. </body>
  13. this example will work in IE 6
  14. </body>
  15. </html>
Freedom in the Mind, Faith in the words.. Pride in our Souls...
Indian Developer
http://falaque.wordpress.com/
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 39
Reputation: Tom Tolleson is an unknown quantity at this point 
Solved Threads: 0
Tom Tolleson's Avatar
Tom Tolleson Tom Tolleson is offline Offline
Light Poster

Re: Ctrl+t?

 
0
  #7
Feb 21st, 2008
Hey! Thanks for the tip!

The following code does the trick:

document.onkeypress=function(){
if (window.event.keyCode == 20) {
alert('It Works!');
}
}

Thanks again!
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 483
Reputation: DangerDev has a spectacular aura about DangerDev has a spectacular aura about 
Solved Threads: 58
DangerDev's Avatar
DangerDev DangerDev is offline Offline
Posting Pro in Training

Re: Ctrl+t?

 
0
  #8
Feb 21st, 2008
good i knew that, but i wanted you to try...any way nice job
Freedom in the Mind, Faith in the words.. Pride in our Souls...
Indian Developer
http://falaque.wordpress.com/
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC