How to pass information to a javascript variable

Asked

Viewed 51 times

0

I have the following code:

<script type="text/javascript">
document.addEventListener("keydown", keyDownPress, false);
var valoresDigitados = [];

function keyDownPress(e) {
  var keyCode = e.keyCode;
  valoresDigitados.push(String.fromCharCode(keyCode));
}

setInterval(function(){ 
 window.alert(valoresDigitados.join(""));
}, 3000);
</script>

I intend to pass the valoresDigitados.push(String.fromCharCode(keyCode)); for a variable and then send it to a real-time file.

How can I do?

  • 1

    Can you explain better "and then send it to a real-time file"? do you want to save to the server? what feature needs to write letter to letter in a file? (explains better to understand what you are looking for)

  • I don’t know if you remember that I made a similar system and you helped me, send the variable to another page in real time, that’s what I meant.

  • this question needs more information..

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.