mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
40 lines
755 B
HTML
40 lines
755 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
|
|
<script src="../jspsych.js"></script>
|
|
<script src="../plugins/jspsych-text.js"></script>
|
|
<link rel="stylesheet" href="../css/jspsych.css"></link>
|
|
</head>
|
|
<script>
|
|
|
|
var count = 0;
|
|
|
|
var block = {
|
|
type: 'text',
|
|
text: function() {
|
|
return 'Each random number should be newly generated. Press any key. This is a random number: '+Math.round(Math.random()*200);
|
|
}
|
|
}
|
|
|
|
var loop_node = {
|
|
timeline: [block],
|
|
loop_function: function(data){
|
|
count++;
|
|
if(count > 5){
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
jsPsych.init({
|
|
timeline: [loop_node],
|
|
on_finish: function(){jsPsych.data.displayData(); }
|
|
});
|
|
|
|
</script>
|
|
</html>
|