jsPsych/examples/function-parameters-reset.html
2016-12-09 21:25:56 -05:00

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>