Hi I've heard different solutions on a problem that I've been hitted, I will explain what I want to do and what I'm working on. I'm working on a "reaction test" and basiclly what you're going to do is press on two buttons when you see a figure pops up either B or R. So but the problem is that somehow I need to send which key that was pressed to a "result file" without showing the user during the test. I have heard that you can do it with cookies, you can use input type hidden and send it to next page, you can use document.write, createelement or just use the GET and POST method. So my question is how should I do it, which way and I wouldn't cry if I could get some help with the code to. I know HTML, CSS, jQuery and JavaScript, I don't want any PHP solutions. Here is three pages so you can know what it looks like, the first two is almost desamme just different colors and shapes so I will just use one of those pages.
Input hidden test.html || Input hidden test 1.html:
<!DOCTYPE html>
<html>
<head>
<title>Input hidden test</title>
<style>
#first-child {
width: 200px;
height: 200px;
background: white;
border-radius: 0%;
margin-top: 150px;
margin-bottom: 50px;
margin-left: 550px;
margin-right: 0px;
-webkit-animation: myfirst 1s;
-moz-animation: myfirst 1s;
animation: myfirst 1s;
}
@-webkit-keyframes myfirst {
0% {background: white;}
20% {background: white;}
40% {background: white;}
60% {background: white;}
80% {background: white;}
100% {background: red;}
}
@keyframes myfirst {
0% {background: white;}
20% {background: white;}
40% {background: white;}
60% {background: white;}
80% {background: white;}
100% {background: red;}
}
#first-parent {
color: blue;
margin-top: 5px;
margin-bottom: 50px;
margin-left: 600px;
margin-right: 0px;
}
#second-parent {
color: red;
margin-top: 0px;
margin-bottom: 50px;
margin-left: 40px;
margin-right: 0px;
}
p {
margin-left: 640px;
}
</style>
</head>
<body>
<div id="first-child"></div>
<button id="first-parent" onclick="">B</button>
<button id="second-parent" onclick="">R</button>
<br />
<p>1/2</p>
<script>
document.onkeypress = function(e) {
e = e || window.event;
var charCode = e.charCode || e.keyCode,
character = String.fromCharCode(charCode);
console.log(charCode);
window.location.href="Input hidden test 1.html";
};
</script>
</html>
Input hidden test 2.html:
<!DOCTYPE html>
<html>
<head>
<title>Input hidden test 2</title>
<style>
</style>
</head>
<body>
<script>
</script>
</html>
And that's it more or less, if there is any questions just ask, peace !