html
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
<p>16x - 8 = 20+4x. Find x.</p>
<p><i>To select an answer, tap on the circles besides the buttons.<br />The password to get the correct answer is in the javascript code.</i></p>
<input type="radio" onclick="val1()" id="x1" name="x"/>
<button id="n1"> 7/3</button><br />
<input type="radio" onclick="val1()" id="x2" name="x"/>
<button id="n2">8/3</button><br />
<input type="radio" onclick="val1()" id="x3" name="x"/>
<button id="n3">3</button><br />
<input type="radio"onclick="val1()" id="x4" name="x"/>
<button id="n4">10/3</button>
<div id="a1">
</div><br />
<button onclick="get()" id="btn">Get answer</button>
<button onclick="closey()" id="btn">Close</button>
<p>16x - 8 = 20+4x. Find x.</p>
<p><i>To select an answer, tap on the buttons.</i></p>
<button onclick="val5()" id="n5"> 7/3</button><br />
<button onclick="val6()" id="n6"> 8/3</button><br />
<button onclick="val7()" id="n7"> 3</button><br />
<button onclick="val8()" id="n8"> 10/3</button><br />
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
4
5
6
7
8
9
10
body {
background-color: #abcdef;
}
#n1,#n2,#n3,#n4,#n5,#n6,#n7,#n8 {
width:50%;
padding:4px 14px;
}
Enter to Rename, Shift+Enter to Preview
js
js
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
function val1() {
var x1= document.getElementById("x1").checked;
var x2= document.getElementById("x2").checked;
var x3= document.getElementById("x3").checked;
var x4= document.getElementById("x4").checked;
var n1 = document.getElementById("n1")
if (x2) {
n2.style= "color:white;background-color:brown;;"
n1.style= "color:white;background-color:blue;;"
var a1 = document.getElementById("a1").innerHTML = "<i style=color:red>Wrong <br/>Try Again</i>";
}
else if (x1){
n1.style= "color:white;background-color:blue;;"
var a1 = document.getElementById("a1").innerHTML = "<i style=color:blue>Good</i>";
}
else if (x3) {
n3.style="color:white;background-color:brown;;"
n1.style="color:white;background-color:blue;;"
var a1 = document.getElementById("a1").innerHTML = "<i style=color:red>Wrong </i>";
}
else if (x4) {
n4.style="color:white;background-color:brown;;"
n1.style="color:white;background-color:blue;;"
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run