mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
45 lines
995 B
HTML
45 lines
995 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">
|
|
<style>
|
|
img {
|
|
width: 300px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body></body>
|
|
<script>
|
|
var images = ["img/1.gif", "img/2.gif", "img/3.gif", "img/4.gif", "img/5.gif", "img/6.gif", "img/7.gif", "img/8.gif", "img/9.gif", "img/10.gif"];
|
|
|
|
var trials = [];
|
|
for (var i = 0; i < images.length; i++) {
|
|
trials.push({
|
|
stimulus: images[i]
|
|
});
|
|
}
|
|
|
|
var block = {
|
|
type: 'image-keyboard-response',
|
|
choices: ['y','n'],
|
|
prompt: '<p>Press "y" to continue. Press "n" to end the experiment.</p>',
|
|
render_on_canvas: false,
|
|
on_finish: function(data) {
|
|
if (data.key_press == 'n') {
|
|
jsPsych.endExperiment('The experiment was ended. This is the end message.');
|
|
}
|
|
},
|
|
timeline: trials
|
|
}
|
|
|
|
|
|
jsPsych.init({
|
|
timeline: [block]
|
|
});
|
|
</script>
|
|
|
|
</html>
|