dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: Noob question regarding key events

Hybrid View

  1. #1
    Join Date
    Oct 2012
    Posts
    1

    Noob question regarding key events

    Hi I'm a little new to JavaScripting and need some guidance. I wan't to be able to click on an image and have it execute a key-shortcut command. For example: If there's an image called "close.jpg" and you click on it, I want it to execute "Ctrl+W" to close tab. Can anyone provide an example code so that I may look over it?

    Thanks in advance.

    Best regards,
    David

  2. #2
    Join Date
    Aug 2008
    Location
    Sweden
    Posts
    227
    I don't believe you can do that. If you just want to close the tab/window you can use window.close().

  3. #3
    Join Date
    Sep 2008
    Location
    Dallas
    Posts
    154
    but you might be able to do something like this: http://www.w3schools.com/jsref/met_win_close.asp

  4. #4
    Join Date
    Sep 2008
    Location
    Dallas
    Posts
    154
    You can test which keys are pressed, but you can't fake a key press - meaning, you can't control the user's keyboard, otherwise, you would be able to close out programs and windows when the user doesn't want that.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles