-
Notifications
You must be signed in to change notification settings - Fork 0
/
Quiz
92 lines (88 loc) · 5.34 KB
/
Quiz
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
87
88
89
90
91
92
<html>
<head>
<title>Forensics quiz</title>
<script type="text/javascript">
var score=0, name;
var yes=function(){alert("Correct!")}, no=function(){alert("wrong!")};
var q1="<h3>Question 1</h3><p/>Which of the following is an example of forensic evidence?<p/><button onclick='yes(); score+=10; qf2();'>Fingerprints</button><button onclick='no(); qf2();'>Suicide note</button><button onclick='no(); qf2();'>Witness testimony</button><button onclick='no(); qf2();'>legal papers</button>";
var q2="<h3>Question 2</h3><p/>If Jon's DNA is at a crime scene, did Jon commit the crime?<p/><button onclick='no(); qf3();'>Yes</button><button onclick='no(); qf3();'>No</button><button onclick='yes(); score+=10; qf3();'>Possibly</button><button onclick='no(); qf3();'>All of the above</button>";
var q3="<h3>Question 3</h3></p>If a police officer asks for a sample of your DNA are you legally required to give your DNA?<p/><button onclick='no(); qf4();'>Yes always</button><button onclick='yes(); score+=10; qf4();'>yes, if you are suspected of or have commited a serious crime in the last six months</button><button onclick='no(); qf4();'>No unless you are a legal minor or do not have Australian citizenship</button><button onclick='no(); qf4();'>No, never</button>";
var q4="<h3>Question 4</h3><p/>Who was the first person to use fingerprints as evidence in a criminal trial?<p/><button onclick='no(); qf5();'>Robert Langdon</button><button onclick='no(); qf5();'/>Jon Doe</button><button onclick='no(); qf5()'>Sherlock Holmes</button><button onclick='yes(); score+=10; qf5();'>Juan Vucetich</button>";
var q5='<h3>Question 5</h3><p/>What is the definition of forensics?<p/><button onclick="no(); qf6();">The study of criminals</button><button onclick="no(); qf6();">There is no dictionary definition</button><button onclick="no(); qf6();">The investigation of violent crimes</button><button onclick="yes(); score+=10; qf6();">scientific tests or techniques used in connection with the detection of crime</button>';
var q6='<h3>Question 6</h3><p/>When was chemical testing first used to convict a poisoner?<p/><button onclick="yes(); score+=10; qf7();">1836</button><button onclick="no(); qf7();">256</button><button onclick="no(); qf7();">2019</button><button onclick="no(); qf7()">never</button>';
var q7='<h3>Question 7</h3><p/>DNA is unique to?<p/><button onclick="no(); qf8();">each individual human</button><button onclick="no(); qf8();">Each individual living thing</button><button onclick="yes(); score+=10; qf8();">Each individual living thing apart from single cells and fraternal twins</button ><button onclick="no(); qf8();">alien life and artificial intelligence</button>';
var q8='<h3>Question 8</h3><p/>What is the focus of Forensic entomology?<p/><button onclick="no(); qf9();">firearms</button><button onclick="no(); qf9();">vehicles and tyres</button><button onclick="yes(); score+=10; qf9();">insects</button><button onclick="no(); qf9();">death</button>';
var q9='<h3>Question 9</h3><p/>Hhow many of Julius Ceasar\'s 23 stab wounds were fatal?<p/><button onclick=" alert( \'Exactly \'); score+=20; end();">lol who</button><button onclick="yes(); score+=10; end();">one</button><button onclick="no(); end();">all of them</button><button onclick="no(); end();">none of them</button>';
function setCookie(cname,cvalue,exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires=" + d.toGMTString();
document.cookie = cname+"="+cvalue+"; "+expires;
}
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++) {
var c = ca[i];
while (c.charAt(0)==' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
function start(){
for(name=0;name<3;--name){
name=getCookie("quizUserName");
if (name=="") {name=prompt("Hello! What is your name","");};
if (name=="") {alert("You must enter your name");}
else {alert("Hello "+name); setCookie("quizUserName", name, 365); document.getElementById("name").innerHTML="<h2>"+name+"</h2>"; break};}
document . getElementById ( 'screen' ). innerHTML =q1;
};
function qf2(){
document.getElementById("screen").innerHTML=q2
};
function qf3(){
document.getElementById("screen").innerHTML=q3;
};
function qf4(){
document.getElementById("screen").innerHTML=q4;
};
function qf5(){
document.getElementById("screen").innerHTML=q5;
};
function qf6(){
document.getElementById("screen").innerHTML=q6;
};
function qf7(){
document.getElementById("screen").innerHTML=q7;
};
function qf8(){
document.getElementById("screen").innerHTML=q8;
};
function qf9(){
document.getElementById("screen").innerHTML=q9;
};
function qf10(){
document.getElementById("screen").innerHTML=q10;
};
function end(){
document.getElementById("screen").innerHTML="<h3>The end</h3><p/>You scored "+score+" points out of a possible 100 points";
};
var s=0, m=0;
function ts(){
++s;
if (s==60) {++m; s=0;};
document.getElementById("ts").innerHTML="Time taken: "+m+" minutes and "+s+" seconds<p/>You have "+score+"points";
};
</script>
</head>
<body onload="start(); setInterval(ts, 1000);">
<h1><a href="http://htmlpreview.github.io/?https://github.com/Utopianii/homepage/blob/master/Main%20page.html">Utopian</a></h1>
<h2 id="name"></h2>
<p id="screen">Hello World!</p>
<p id="ts"><p/>
</body>
</html>