Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
86 lines (68 sloc) 2.77 KB
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>TheFragebogen: printable example</title>
<link rel="stylesheet" type="text/css" href="example.css">
<script src="../thefragebogen.js"></script>
<style>
@media print {
body {
counter-reset: page;
}
body>div::after {
counter-increment: page;
content: "Page "counter(page);
}
body>div:first-of-type {
page-break-before: avoid;
}
body>div {
page-break-before: always;
}
body>div>input[type="button"]:last-of-type {
/* Omit next button of ScreenUIElements */
display: none;
}
}
</style>
<script>
//This array stores all screens that will be shown.
var screens = [];
screens.push(
new ScreenUIElements(
new UIElementHTML(undefined, "<h1>TheFragebogen</h1>"),
new UIElementHTML(undefined, "This demo has CSS to be printed.<br>Just try to print this web page."),
new UIElementHTML(undefined, "Each screen will be printed on a separate page and the 'Next'-button will be hidden."),
new QuestionnaireItemDefinedOne(undefined, "Are you ready?", true, ["Yes"])
)
);
screens.push(
new ScreenUIElements(
new UIElementHTML(undefined, "Just some basic questions.<br>The 2nd must be answered."),
new QuestionnaireItemDefinedOne(undefined, "QuestionnaireItemDefinedOne: Question with a defined set of options, where only one option can be selected.", false, ["Option 1", "Option 2", "Option 3"]),
new QuestionnaireItemDefinedMulti(undefined, "QuestionnaireItemDefinedMulti: Question with a defined set of options, where multiple options can be selected.", true, ["Option 1", "Option 2", "Option 3"])
)
);
</script>
<script>
function start() {
document.body.innerHTML += "TheFragebogen loaded.";
if (typeof(screens) === "undefined") {
document.body.innerHTML += "<i>Something went wrong:</i> Please check the configuration.";
return;
}
document.body.innerHTML = "";
for (var i = 0; i < screens.length; i++) {
document.body.appendChild(screens[i].createUI());
}
}
window.print();
</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>
You can’t perform that action at this time.