-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmultiplechoice.html
86 lines (70 loc) · 2.45 KB
/
multiplechoice.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!DOCTYPE html>
<html>
<head><style>
body {font-family: Arial;}
button {
background-color:#1a73e8;
border-radius:4px;
border:1px solid white;
display:inline-block;
cursor:pointer;
color:#ffffff;
font-size:13px;
font-weight:bold;
padding:8px 18px;
}
textarea{
border: 2px solid #616161;
border-radius: 4px;
}
input[type=text]{
border: 2px solid #616161;
border-radius: 4px;
}
</style></head>
<body>
<div class="sidebar branding-below">
<div class="block col-contain">
<h1 class="col-one"><strong>Multiple Choice</strong></h1>
<p><strong>Question: </strong><br><textarea id="question" class="width-100" rows="1"></textarea></p>
</div>
<p><strong>Options (seperated by comma): </strong><textarea id="options" class="width-100" rows="10"></textarea></p>
<p><strong>Option type: </strong><br>
<input type="radio" name="style" value="1"><label for="style">Checkbox</label><br>
<input type="radio" name="style" value="2"><label for="style">Letter</label></p>
</div>
<div class="col-one"> </div>
<div class="block"><input type="checkbox" id="is-graded"><label for="is-graded">Graded?</label></div>
<p><strong>Points: </strong><input type="text" id="points" class="width-100" rows="1"></p>
<p><strong>Correct Response (number): </strong></p>
<input type="text" id="correct-response" class="width-100" rows="1">
<div class="col-one"> </div>
<div class="block"><button id="create-and-place" class="blue">Create and Place</button></div>
<div id = "output"></div>
<script>
function onFailure(error){
var div = document.getElementById("output");
div.innerHTML = "ERROR: " + error.message;
}
document.getElementById("create-and-place").addEventListener("click",create);
function create(){
question = document.getElementById("question").value;
options = document.getElementById("options").value;
style = 1;
is_graded = document.getElementById("is-graded").checked;
points = document.getElementById("points").value;
correct = document.getElementById("correct-response").value;
styleChoice = document.getElementsByName("style");
for(i=0; i<styleChoice.length; i++){
if(styleChoice[i].checked)
style = styleChoice[i].value;
}
msg = "Question: " + question + "\nOptions: " + options + "\n";
if(is_graded) {
msg += "Points: " + points + "\nCorrect response: " + correct;
}
//alert(msg);
google.script.run.withFailureHandler(onFailure).addMultipleChoice(question,options,style,is_graded,points,correct);
}
</script>
</body></html>