From 08ee4cd03f5f5cd80296137b3be69301cca17364 Mon Sep 17 00:00:00 2001 From: annoum Date: Tue, 13 Nov 2018 15:02:30 +0000 Subject: [PATCH] added a version of javascript to implement quiz git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@161 a672b425-5310-4d7a-af5c-997e18724b81 --- site/pages/fs/ab_re_quiz.html | 63 +++++++++++++++++++++++++++++++++++ site/pages/fs/java_ab_re.js | 51 ++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 site/pages/fs/java_ab_re.js diff --git a/site/pages/fs/ab_re_quiz.html b/site/pages/fs/ab_re_quiz.html index 09ad92c..e6e9dff 100644 --- a/site/pages/fs/ab_re_quiz.html +++ b/site/pages/fs/ab_re_quiz.html @@ -30,3 +30,66 @@ Yeah, right, there is a quiz. + + + + + + + + + + +

Are you ready for the quiz?

+ + +
+ + + +

What is path?

+ + Is a location to a folder or file in a file system of a Operating System
+ Is an Operating System
+ Is a folder that you can find on your Operating System
+ + + +

What is an absolute path?

+ + The bigger folder that you can find on your Operating System
+ Is defined as specifying the location of a file or directory from the root directory(/)
+ The last location of a file or directory from Documents
+ + + +

"cat /home/a1/group1.txt" it's an example of absolute path?

+ + YES
+ NO
+ + +

If you choose "NO" why it's not correct? if you think it's correct don't write anything

+ + + + +

"pwd/home/user1cd Documents" it's an example of relative path?

+ + YES
+ NO
+ + + + + +

+ + +
+ +
+

+

+ +
diff --git a/site/pages/fs/java_ab_re.js b/site/pages/fs/java_ab_re.js new file mode 100644 index 0000000..e742473 --- /dev/null +++ b/site/pages/fs/java_ab_re.js @@ -0,0 +1,51 @@ +function check(){ + + var question1 = document.quiz.question1.value; + var question2 = document.quiz.question2.value; + var question3 = document.quiz.question3.value; + var question4 = document.quiz.question4.value; + var question5 = document.quiz.question5.value; + + + var correct = 0; + + + if (question1 == "Is a location to a folder or file in a file system of a Operating System") { + correct++; +} + if (question2 == "Is defined as specifying the location of a file or directory from the root directory(/)") { + correct++; +} + if (question3 == "YES") { + correct++; + } + if (question4 == "") { + 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 = 3; + } + + if (correct > 0 && correct < 4) { + score = 2; + } + + if (correct == 4) { + 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]; + } + v0dfsew