mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-12 08:38:11 +00:00
45 lines
1.1 KiB
HTML
45 lines
1.1 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<script src="js/jquery.min.js"></script>
|
|
<script src="../jspsych.js"></script>
|
|
<script src="../plugins/jspsych-single-stim.js"></script>
|
|
<link rel="stylesheet" href="../css/jspsych.css"></link>
|
|
<style>
|
|
img { width: 300px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="jspsych-target"></div>
|
|
</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 block_1 = {
|
|
type: 'single-stim',
|
|
stimuli: images,
|
|
choices: [89,78], // Y or N
|
|
prompt: '<p class="center-content">Press Y to Continue. Press N to end the experiment</p>',
|
|
on_finish: function(data){
|
|
if(data.key_press == 78){
|
|
jsPsych.endExperiment();
|
|
}
|
|
}
|
|
}
|
|
|
|
function start(){
|
|
jsPsych.init({
|
|
display_element: $('#jspsych-target'),
|
|
experiment_structure: [block_1],
|
|
on_finish: function(){
|
|
jsPsych.data.displayData();
|
|
}
|
|
});
|
|
}
|
|
|
|
jsPsych.preloadImages(images, start);
|
|
|
|
</script>
|
|
</html>
|