jsPsych/examples/progress-bar.html

63 lines
1.5 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<script src="../jspsych.js"></script>
<script src="../plugins/jspsych-image-keyboard-response.js"></script>
<script src="../plugins/jspsych-html-keyboard-response.js"></script>
<link rel="stylesheet" href="../css/jspsych.css">
</head>
<body></body>
<script>
var trial_1 = {
type: 'image-keyboard-response',
stimulus: 'img/happy_face_1.jpg',
choices: ['y','n'],
render_on_canvas: false,
stimulus_width: 300,
prompt: '<p>Have you seen this face before? Press "y" or "n".</p>'
}
var trial_2 = {
type: 'image-keyboard-response',
stimulus: 'img/happy_face_2.jpg',
choices: ['y','n'],
render_on_canvas: false,
stimulus_width: 300,
prompt: '<p>Have you seen this face before? Press "y" or "n".</p>'
}
var trial_3 = {
type: 'image-keyboard-response',
stimulus: 'img/happy_face_3.jpg',
choices: ['y','n'],
render_on_canvas: false,
stimulus_width: 300,
prompt: '<p>Have you seen this face before? Press "y" or "n".</p>'
}
var count = 0;
var block_set = {
timeline: [trial_1, trial_2, trial_3],
loop_function: function() {
count++;
return count < 2;
}
}
var end_screen = {
type: 'html-keyboard-response',
stimulus: 'The experiment is over.'
}
jsPsych.init({
timeline: [trial_1, trial_2, trial_3], //block_set, end_screen],
show_progress_bar: true,
on_finish: function() {
jsPsych.data.displayData();
}
});
</script>
</head>
</html>