jsPsych/tests&examples/function-parameters-reset.html
Josh de Leeuw 4de65db9d9 fixes #211
2016-01-07 16:34:03 -05:00

44 lines
839 B
HTML

<!doctype html>
<html>
<head>
<script src="js/jquery.min.js"></script>
<script src="../jspsych.js"></script>
<script src="../plugins/jspsych-text.js"></script>
<link rel="stylesheet" href="../css/jspsych.css"></link>
</head>
<body>
<div id="jspsych-target"></div>
</body>
<script>
var count = 0;
var block = {
type: 'text',
text: function() {
return 'Hello. 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({
display_element: $('#jspsych-target'),
timeline: [loop_node],
on_finish: function(){jsPsych.data.displayData(); }
});
</script>
</html>