mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-11 03:30:54 +00:00

fixed by changing the evaluate parameters function to modify the trial object directly, so the function is replaced by its value.
38 lines
1005 B
HTML
38 lines
1005 B
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 block_1 = {
|
|
type: 'single-stim',
|
|
stimuli: ['img/happy_face_1.jpg', 'img/sad_face_1.jpg'],
|
|
choices: [89,78], // Y or N
|
|
prompt: '<p class="center-content">Have you seen this face before? Y or N.</p>',
|
|
data: {trial_data: true},
|
|
timing_post_trial: function() { return Math.floor(Math.random()*1000 + 250) }
|
|
}
|
|
|
|
function start(){
|
|
jsPsych.init({
|
|
display_element: $('#jspsych-target'),
|
|
experiment_structure: [block_1],
|
|
on_finish: function(){ jsPsych.data.displayData(); }
|
|
});
|
|
}
|
|
|
|
jsPsych.preloadImages(['img/happy_face_1.jpg','img/sad_face_1.jpg'], start);
|
|
|
|
</script>
|
|
</html>
|