mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
57 lines
1.1 KiB
HTML
57 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<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" class="jspsych-display-element" style="border:1px solid red;"></div>
|
|
<div id="jspsych-trial-target" class="jspsych-display-element" style="border:1px solid blue; height: 300px;"></div>
|
|
</body>
|
|
<script>
|
|
var trial_1 = {
|
|
stimulus: 'img/happy_face_1.jpg',
|
|
}
|
|
|
|
var trial_2 = {
|
|
stimulus: 'img/sad_face_1.jpg',
|
|
}
|
|
|
|
var trial_3 = {
|
|
stimulus: '<p>:)</p>',
|
|
is_html: true,
|
|
display_element: 'jspsych-trial-target'
|
|
}
|
|
|
|
var node = {
|
|
type: 'single-stim',
|
|
timeline: [trial_1, trial_2, trial_3],
|
|
choices: [89, 78], // Y or N
|
|
prompt: '<p class="center-content">Have you seen this face before? Y or N.</p>',
|
|
data: {
|
|
node_data: true
|
|
}
|
|
}
|
|
|
|
|
|
jsPsych.init({
|
|
display_element: 'jspsych-target',
|
|
timeline: [node],
|
|
on_finish: function() {
|
|
jsPsych.data.displayData();
|
|
},
|
|
default_iti: 250
|
|
});
|
|
</script>
|
|
|
|
</html>
|