forked from msaddler/jspsych_tutorial_960
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0_hello_world.html
executable file
·42 lines (34 loc) · 1.48 KB
/
0_hello_world.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE html>
<html>
<head>
<title>Hello World</title>
<meta http-equiv="pragma" content="no-cache">
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
<link href="https://unpkg.com/[email protected]/css/jspsych.css" rel="stylesheet" type="text/css" />
<script src="https://unpkg.com/[email protected]"></script>
<script src="https://unpkg.com/@jspsych/[email protected]"></script>
<script src="https://unpkg.com/@jspsych/[email protected]"></script>
</head>
<body></body>
<script>
// Initialize the jsPsych object (possibly with arguments: https://www.jspsych.org/7.3/reference/jspsych/)
var jsPsych = initJsPsych();
// Initialize a timeline (just an empty array)
var timeline = [];
// Add some trial objects to the timeline (like appending dictionaries to a Python list)
var trial_0 = {
type: jsPsychHtmlKeyboardResponse, // This trial will use the "html-keyboard-response" plugin
stimulus: '<h2>Hello world!</h2><p>Press `shift` or `spacebar` to continue.</p>',
choices: ['shift', ' '],
};
timeline.push(trial_0);
var trial_1 = {
type: jsPsychHtmlButtonResponse, // This trial will use the "html-button-response" plugin
stimulus: '<h2>Hello world!</h2><p>Press one of the buttons below.</p>',
choices: ['End experiment', 'Complete experiment', 'Finish experiment'],
};
timeline.push(trial_1);
// Run the timeline
jsPsych.run(timeline);
</script>
</html>