Jump to content

Detecting "Lost" Keystrokes?


davej

Recommended Posts

http://www.w3schools.com/jsref/event_onkeypress.asphttp://www.w3schools.com/jsref/event_onkeydown.asphttp://www.w3schools.com/jsref/event_onkeyup.asp Is there any way to detect keystrokes when the user has clicked on the form and then entered keystrokes that are otherwise going to be ignored? The user has clicked on the form but not clicked into a textbox. Thanks.
Link to comment
Share on other sites

By recording the value of every keystroke in a table if you want to.

Edited by niche
Link to comment
Share on other sites

I guess I'm missing some sort of requirement that the OP is looking for, cause I don't see how Ajax or databases fit in.

Link to comment
Share on other sites

Probably so. I wrote thinking that he meant "save". Thanks for questioning that scientist.

Edited by niche
Link to comment
Share on other sites

Well, isn't AJAX irrelevant until the key capture event is proved out? I see there are some tricks to get it working: http://www.quirksmode.org/js/keys.html In a Yahoo forum I saw some bozo ask how he might create a keylogger, but the usefulness I see is creating an error beep if a "hunt and peck" typist is not typing in a valid field -- but this introduces the problem of creating an error beep. The following code detects the key event but does not identify the key in Firefox...

<!DOCTYPE html><html><head><script type="text/javascript">function myFunction(e){var kc = e.keyCode;var ki = e.keyIdentifiervar kl = e.keyLocation//var c = String.fromCharCode(k);alert("Key [" + kc + " " + ki + " " + kl+ "] was pressed down");//document.getElementFromId("txt1").value = kc +" "+ ki +" "+ kl;}</script></head><body id="body1" onkeypress="myFunction(event)"> Detected keystroke: <input type="text" id="txt1"> </body></html>

Edited by davej
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...