@JoshDaBosh/

jeopardy-1

HTML, CSS, JS

No description

fork
loading
Files
  • index.html
  • jeopardy.jpg
  • jeopardy.png
  • script.js
  • style.css
index.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<html>
<head>
  <title>Jeopardy</title>
  <script language="Javascript">
    var winpopup;
    var globAns = "";
    var qVal = "";
    var randomTurns;
	  var turns = 0;
	
    function question(myString, ans, Bid){
	  
      winpopup = window.open("",'popup', 'height=200, width=600,left= 900, top= 0');
      winpopup.document.write("<title>You have 5 seconds</title>");
      winpopup.document.write(myString);
      winpopup.document.close(); //Close the Window from additional writes
      setTimeout(closePopup, 5000);
      globAns=ans;
      qVal=parseInt(document.getElementById(Bid).value.substring(1));
      document.getElementById(Bid).disabled=true;
	    turns+=1
    }
    function closePopup(){
      winpopup.close();
    }
    function giveAnswer(){
      if(globAns!=""){
        anspopup = window.open("",'popup', 'height=200, width=600,left= 900, top= 0');
        anspopup.document.write("<title>Answer</title>");
        anspopup.document.write(globAns);
        anspopup.document.close()
      }
    }
    function correctAns(){
	//alert(document.getElementById("contestant").checked)
      if(qVal!=""){
        if(document.getElementById("contestant").checked){
          document.getElementById("g1").value=(parseInt(document.getElementById("g1").value) + qVal).toString();
		      qVal = "";
        }
        else if(document.getElementById("contestant").checked){
          document.getElementById("g2").value=(parseInt(document.getElementById("g2").value) + qVal).toString();
		      qVal = "";
        }
        else if(document.getElementById("contestant").checked){
          document.getElementById("g3").value=(parseInt(document.getElementById("g3").value) + qVal).toString();
		      qVal = "";
        }
        else if(document.getElementById("contestant").checked){
          document.getElementById("g4").value=(parseInt(document.getElementById("g4").value) + qVal).toString();
		      qVal = "";
        }
      }

      }
    
    function wrongAns(){
      if(qVal!=""){
        if(document.getElementById("contestant").checked){
          document.getElementById("g1").value=(parseInt(document.getElementById("g1").value) - qVal).toString();
		      qVal = "";
        }
        else if(document.getElementById("contestant").checked){
          document.getElementById("g2").value=(parseInt(document.getElementById("g2").value) - qVal).toString();
		      qVal = "";
        }
        else if(document.getElementById("contestant").checked){
          document.getElementById("g3").value=(parseInt(document.getElementById("g3").value) - qVal).toString();
		      qVal = "";
        }
        else if(document.getElementById("contestant").checked){
          document.getElementById("g4").value=(parseInt(document.getElementById("g4").value) - qVal).toString();
		      qVal = "";
      }
    }
	}
  var doubleTurnList=[];
  function chooseDouble(){
    console.log(doubleTurnList.length);
    randomTurns = Math.floor(Math.random()*20);
    console.log(randomTurns);
    doubleTurnList.push(randomTurns);
    console.log(typeof 4)

    while(doubleTurnList.length < 4){
        randomTurns = Math.floor(Math.random()*20);
        if(!(doubleTurnList.includes(randomTurns))){
          doubleTurnList.push(randomTurns);
        }
    }
    
  }
      
  </script>

</head>
<body onload="chooseDouble()" >
  <center>
    <img src="jeopardy.png" style="width:450px;height:150px;"><br>
    <form id="f1">
    <input type="radio" id="contestant" value="g1" checked>g1
	
    <input type="radio" id="contestant" value="g2">g2
    <input type="radio" id="contestant" value="g3">g3
    <input type="radio" id="contestant" value="g4">g4<br>
    </form>
    <form id="f2">
      Physics & Chemistry&nbsp;&nbsp;&nbsp;Materials&nbsp;&nbsp;&nbsp;Living Stuff&nbsp;&nbsp;&nbsp;Health & Medicine<br>
      <input type = "button" id = "PC1" value = "$200" onClick = "question('0 degrees kelvin', 'What is absolute zero?', id)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type = "button" id = "M1" value = "$200" onClick = "question('The definition of petrology', 'What is the study of rocks?', id)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type = "button" id = "LS1" value = "$200" onClick = "question('The man who wrote On the Origin of Species', 'Who was Charles Darwin?', id)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type = "button" id = "HM1" value = "$200" onClick = "question('The sport with the highest injury rate', 'What is football?', id)"><br>

      <input type = "button" id = "PC2" value = "$400" onClick = "question('The speed of light', 'How much is 186282 miles (299792) km per second?', id)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type = "button" id = "M2" value = "$400" onClick = "question('The definition of the Mohs scale', 'What is a standard of 10 minerals by which the hardness of a mineral is rated?', id)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type = "button" id = "LS2" value = "$400" onClick = "question('A 15 year 3 billion dollar project to map the entire human genome, of which 2000 genes have been mapped', 'What is the Genome Project?', id)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type = "button" id = "HM2" value = "$400" onClick = "question('What cholestrol and fats are transported as', 'What are lipoproteins?', id)"><br>

      <input type = "button" id = "PC3" value = "$600" onClick = "question('Particles that are smaller than atoms', 'What are subatomic particles?', id)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type = "button" id = "M3" value = "$600" onClick = "question('This makes stainless steel stainless', 'What is chromium?', id)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type = "button" id = "LS3" value = "$600" onClick = "question('The full name of DNA', 'What is deoxyribonucleic acid?', id)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type = "button" id = "HM3" value = "$600" onClick = "question('Also known as epicondylitis;repeated strain on the forearm', 'What is tennis elbow?', id)"><br>

      <input type = "button" id = "PC4" value = "$800" onClick = "question('This element makes up about half the total mass of the crust, water, and atmosphere in the Earth', 'What is oxygen?', id)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type = "button" id = "M4" value = "$800" onClick = "question('The resin produced after the distillation of turpentine, obtained from several varieties of pine trees', 'What is rosin?', id)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type = "button" id = "LS4" value = "$800" onClick = "question('There are over 1000 mitochondria in each cell of this body part', 'What is the human liver?', id)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type = "button" id = "HM4" value = "$800" onClick = "question('When a branch of the median nerve in the forearm is compressed at the wrist as it passes through the tunnel formed by the carpals and a ligament that lies under the skin', 'When does Carpal Tunnel Syndrom occur?', id)"><br>

      <input type = "button" id = "PC5" value = "$1000" onClick = "question('Any thermodynamic process in which no heat transfer takes place between a system and its surrounding environment', 'What is an adiabatic process?', id)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type = "button" id = "M5" value = "$1000" onClick = "question('The chemical formula for TNT', 'What is C7H5N3O6?', id)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type = "button" id = "LS5" value = "$1000" onClick = "question('These are microsopic bits of DNA or RNA that bind to the DNA or RNA of a cell and interferes with its activity. It is hoped that these molecules can slow some types of cancer.', 'What is antisense?', id)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type = "button" id = "HM5" value = "$1000" onClick = "question('A useful, non invasive, and non ionizing method for the diagnosis of small tumors, blocked blood vessels, or damaged vertebral disks. It doesnt use radiation.', 'What is nuclear mangetic resonance imaging?', id)"><br>
    
    </form>
    <form id="f3">
      <input type="button" id="correct" value="Correct" onclick="correctAns()">&nbsp;&nbsp;&nbsp;&nbsp;
      <input type="button" id="wrong" value="Wrong" onclick="wrongAns()">&nbsp;&nbsp;&nbsp;&nbsp;
      <input type="button" id="answer" value="Answer" onclick="giveAnswer()"><br><br><br>
      Scores:<br><br>
      G1: <input type="text" readonly value="0" id="g1">
      G2: <input type="text" readonly value="0" id="g2">
      G3: <input type="text" readonly value="0" id="g3">
      G4: <input type="text" readonly value="0" id="g4">
    </form>
  </center>
</body>
</html>
result
console