jsPsych/examples/data-from-timeline.html

46 lines
916 B
HTML

<!DOCTYPE html>
<html>
<head>
<script src="../jspsych.js"></script>
<script src="../plugins/jspsych-image-keyboard-response.js"></script>
<link rel="stylesheet" href="../css/jspsych.css">
</head>
<body></body>
<script>
var trial_1 = {
stimulus: 'img/happy_face_4.jpg',
}
var trial_2 = {
stimulus: 'img/sad_face_4.jpg',
}
var trial_3 = {
stimulus: 'img/sad_face_3.jpg',
}
var node = {
type: 'image-keyboard-response',
timeline: [trial_1, trial_2, trial_3],
choices: ['y','n'],
prompt: '<p>Have you seen this face before? Press "y" or "n".</p>',
stimulus_width: 300,
data: {
node_data: true
},
on_finish: function(){
console.log(jsPsych.data.getLastTimelineData().json());
}
}
jsPsych.init({
timeline: [node],
on_finish: function() {
jsPsych.data.displayData();
},
default_iti: 250
});
</script>
</html>