forked from jspsych/jsPsych
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjspsych-cloze.html
42 lines (34 loc) · 995 Bytes
/
jspsych-cloze.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>
<script src="../jspsych.js"></script>
<script src="../plugins/jspsych-cloze.js"></script>
<link rel="stylesheet" href="../css/jspsych.css">
<style>
img {
width: 300px;
}
</style>
</head>
<body></body>
<script>
var timeline = [];
// simple example using default settings (no check against correct solution, no custom button text)
timeline.push({
type: 'cloze',
text: 'The %% is the largest terrestrial mammal. It lives in both %% and %%.'
});
// more elaborate example (with check against correct solution, custom error handling and modified button text)
timeline.push({
type: 'cloze',
text: 'A rectangle has % 4 % corners and a triangle has % 3 %.',
check_answers: true,
button_text: 'Next',
mistake_fn: function () { alert("Wrong answer. Please check again.") }
});
jsPsych.init({
timeline: timeline,
on_finish: function () { jsPsych.data.displayData(); }
});
</script>
</html>