Results 1 to 2 of 2

Thread: Reading Keypresses without Events?

  1. #1
    Join Date
    Oct 2008
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Reading Keypresses without Events?

    I am aware of being able to use the key events to find keypresses, but I'm looking for a way to read if any keys on the keyboard have been pressed at the time a function is run.

    I am working on a script that is intended to check if the viewer is actively typing anything within the webpage (including iframes, which the normal key events can't reach). Even if they're not typing in a text box, such as using arrow keys to navigate around the page.

    I seem to remember a method of using JavaScript to read what the last key pressed was, without needing to use events. Is this possible? If not, is there any way to get the key events to work on an iframe without having to modify the content of the page in the iframe?
    Last edited by CCH; 12-11-2009 at 09:24 AM.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    My only idea of how to work with this is to use events to store what/when is pushed, then keep that data somewhere (ie, a variable called "lastactivity") and then do whatever you want with it later without needing to (directly) use events.
    As for an iframe, I'm really not sure what is possible there.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

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