mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00
55 lines
1.6 KiB
HTML
55 lines
1.6 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<script src="../packages/jspsych/dist/index.browser.js"></script>
|
|
<script src="../packages/plugin-html-button-response/dist/index.browser.js"></script>
|
|
<link rel="stylesheet" href="../packages/jspsych/css/jspsych.css">
|
|
</head>
|
|
<body></body>
|
|
<script>
|
|
|
|
var jsPsych = initJsPsych({
|
|
on_finish: function() {
|
|
jsPsych.data.displayData();
|
|
}
|
|
});
|
|
|
|
var timeline = [];
|
|
|
|
timeline.push({
|
|
type: jsPsychHtmlButtonResponse,
|
|
stimulus: '<p style="color: red; font-size: 48px; font-weight: bold;">GREEN</p>',
|
|
choices: ['Green', 'Blue', 'Red'],
|
|
prompt: "<p>What color is this word? (flex layout)</p>"
|
|
});
|
|
|
|
timeline.push({
|
|
type: jsPsychHtmlButtonResponse,
|
|
stimulus: '<p style="color: red; font-size: 48px; font-weight: bold;">GREEN</p>',
|
|
choices: ['Green', 'Blue', 'Red'],
|
|
button_layout: "grid",
|
|
prompt: "<p>What color is this word? (grid layout)</p>"
|
|
});
|
|
|
|
timeline.push({
|
|
type: jsPsychHtmlButtonResponse,
|
|
stimulus: '<p style="color: green; font-size: 48px; font-weight: bold;">GREEN</p>',
|
|
choices: ['Green', 'Blue', 'Red'],
|
|
stimulus_duration: 1000,
|
|
prompt: "<p>What color is this word? (word disappears after 1s)</p>"
|
|
});
|
|
|
|
timeline.push({
|
|
type: jsPsychHtmlButtonResponse,
|
|
stimulus: '<p style="color: blue; font-size: 48px; font-weight: bold;">RED</p>',
|
|
choices: ['Green', 'Blue', 'Red'],
|
|
trial_duration: 2000,
|
|
response_ends_trial: false,
|
|
prompt: "<p>What color is this word? (trial ends after 2s)</p>"
|
|
});
|
|
|
|
jsPsych.run(timeline);
|
|
|
|
</script>
|
|
</html>
|