-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathexample_dynamic.html
More file actions
58 lines (47 loc) · 2.48 KB
/
example_dynamic.html
File metadata and controls
58 lines (47 loc) · 2.48 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>TheFragebogen: dynamic questionnaire</title>
<link rel="stylesheet" type="text/css" href="example.css">
<script src="../thefragebogen.js"></script>
<script>
var screenController = new ScreenController(
new ScreenUIElements(
new UIElementHTML(undefined, "<h1>TheFragebogen</h1>"),
new UIElementHTML(undefined, "This demo shows you how to create 'dynamic' or so-called responsive questionnaires."),
new UIElementHTML(undefined, "Each time pressing 'Next' a new ScreenUIElements is created, which shows the time at which the previous screen was started."),
new UIElementHTML(undefined, "This questionnaire does not end and will always look the same."),
new QuestionnaireItemSystemScreenDateTime())
);
</script>
<script>
function start() {
document.body.innerHTML += "TheFragebogen loaded.";
if (typeof(screenController) === "undefined") {
document.body.innerHTML += "<br><i>Something went wrong:</i> Please check that thefragebogen.js was loaded and that the configuration is ok.";
return;
}
screenController.init(document.body);
screenController.setCallbackScreenFinished(function() {
screenController.getCurrentScreenIndex();
var nextIndex = screenController.addScreen(new ScreenUIElements(
new UIElementHTML(undefined, "<h1>TheFragebogen</h1>"),
new UIElementHTML(undefined, "This demo shows you how to create 'dynamic' or so-called responsive questionnaires."),
new UIElementHTML(undefined, "Each time pressing 'Next' a new ScreenUIElements is created, which shows the time at which the previous screen was started."),
new UIElementHTML(undefined, "" + screenController.getCurrentScreen().uiElements[4].getAnswer()),
new QuestionnaireItemSystemScreenDateTime()
));
screenController.goToScreenAbsolute(nextIndex);
return false;
});
screenController.start();
}
</script>
</head>
<body onload="start()">
<p>
TheFragebogen will be shown here.<br> If something fails while starting, an error message will be shown here.
</p>
</body>
</html>