From 8f667b6463cf30171448ebc21f1e3f10320f27c2 Mon Sep 17 00:00:00 2001 From: annoum Date: Tue, 13 Nov 2018 15:06:16 +0000 Subject: [PATCH] modify ab_re_quiz about fs with an example of quiz in javascript and added an example folder to do quiz in the other pages git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@162 a672b425-5310-4d7a-af5c-997e18724b81 --- .../fs/example_quiz_java/exampleofcss.css | 74 +++++++++++++++++++ site/pages/fs/example_quiz_java/javasc.html | 45 +++++++++++ site/pages/fs/example_quiz_java/main.js | 40 ++++++++++ site/pages/fs/java_ab_re.js | 16 ++-- 4 files changed, 167 insertions(+), 8 deletions(-) create mode 100644 site/pages/fs/example_quiz_java/exampleofcss.css create mode 100644 site/pages/fs/example_quiz_java/javasc.html create mode 100644 site/pages/fs/example_quiz_java/main.js diff --git a/site/pages/fs/example_quiz_java/exampleofcss.css b/site/pages/fs/example_quiz_java/exampleofcss.css new file mode 100644 index 0000000..a063419 --- /dev/null +++ b/site/pages/fs/example_quiz_java/exampleofcss.css @@ -0,0 +1,74 @@ +body { + font-family: 'Lato', sans-serif; +} + + + +#quiz { + margin-left: 10px; + background: #d2def2; + padding: 10px 20px 10px 20px; + width: 400px; + border-radius: 20px; + float: left; + +} + +input { + margin-bottom: 20px; + display: block; +} + +#textbox { + height: 25px; + font-size: 16px; + border-radius: 5px; + border: none; + padding-left: 5px; +} + + +#button { + background: green; + border: none; + border-radius: 5px; + padding: 10px; + color: white; + font-size: 16px; + transition-duration: .5s; + margin-top: 15px; +} + + + +#button:hover { + background: white; + border: 1px solid green; + color: black; + cursor: pointer; + +} + +#after_submit { + visibility: hidden; + background: #ff5459; + padding: 10px 20px 10px 20px; + width: 400px; + border-radius: 20px; + float: left; + margin-left: 20px; + font-size: 30px; + + +} + +#picture { + width: 375px; + height: 245px; +} + + + +#mc { + display: inline; +} diff --git a/site/pages/fs/example_quiz_java/javasc.html b/site/pages/fs/example_quiz_java/javasc.html new file mode 100644 index 0000000..733df7d --- /dev/null +++ b/site/pages/fs/example_quiz_java/javasc.html @@ -0,0 +1,45 @@ + + + + + SA group-1 + + + + + + + + +

Are you ready for the quiz?

+ + +
+ + +

Which of the two groups are better?

+ + +

What is unix?

+ A dog
+ A type of..
+ +

What is absolute path?

+ + A type of..
+ A dog
+ + +

+ + +
+ +
+

+

+ +
+ + + diff --git a/site/pages/fs/example_quiz_java/main.js b/site/pages/fs/example_quiz_java/main.js new file mode 100644 index 0000000..01041a0 --- /dev/null +++ b/site/pages/fs/example_quiz_java/main.js @@ -0,0 +1,40 @@ +function check(){ + + var question1 = document.quiz.question1.value; + var question2 = document.quiz.question2.value; + var question3 = document.quiz.question3.value; + var correct = 0; + + + if (question1 == "group1") { + correct++; +} + if (question2 == "A type of..") { + correct++; +} + if (question3 == "A type of..") { + correct++; + } + + var pictures = ["img/win.gif", "img/meh.jpeg", "img/lose.gif"]; + var messages = ["Great job!", "That's just okay", "You really need to do better"]; + var score; + + if (correct == 0) { + score = 2; + } + + if (correct > 0 && correct < 3) { + score = 1; + } + + if (correct == 3) { + score = 0; + } + + document.getElementById("after_submit").style.visibility = "visible"; + + document.getElementById("message").innerHTML = messages[score]; + document.getElementById("number_correct").innerHTML = "You got " + correct + " correct."; + document.getElementById("picture").src = pictures[score]; + } diff --git a/site/pages/fs/java_ab_re.js b/site/pages/fs/java_ab_re.js index e742473..d7ba9fb 100644 --- a/site/pages/fs/java_ab_re.js +++ b/site/pages/fs/java_ab_re.js @@ -22,8 +22,9 @@ function check(){ if (question4 == "") { correct++; } - - + if (question5 == "YES") { + correct++; + } var pictures = ["img/win.gif", "img/meh.jpeg", "img/lose.gif"]; @@ -31,14 +32,14 @@ function check(){ var score; if (correct == 0) { + score = 4; + } + + if (correct > 0 && correct < 5) { score = 3; } - if (correct > 0 && correct < 4) { - score = 2; - } - - if (correct == 4) { + if (correct == 5) { score = 0; } @@ -48,4 +49,3 @@ function check(){ document.getElementById("number_correct").innerHTML = "You got " + correct + " correct."; document.getElementById("picture").src = pictures[score]; } - v0dfsew