-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmathproblems1.html
More file actions
55 lines (53 loc) · 1.24 KB
/
mathproblems1.html
File metadata and controls
55 lines (53 loc) · 1.24 KB
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Math Practice</title>
<style type="text/css">
h1 {
text-align: center;
font-family: Sans-Serif;
font-weight: bold;
font-size: 36px;
margin: 20px 0 0 0;
padding: 0;
}
#whole {
margin-left: auto;
margin-right: auto;
}
table.problem {
font-family: Sans-Serif;
font-size: 24px;
text-align: right;
border-bottom: solid;
margin: 40px;
}
</style>
<script>
function single_problem() {
var operator = "×"; //×
var top = Math.floor(Math.random()*90 + 10);
var bottom = Math.floor(Math.random()*8 + 2);
return '<table class="problem">' +
'<tr><td></td><td>' + top + '</td></tr>' +
'<tr><td>' + operator + '</td><td> ' + bottom + '</td></tr>' +
'</table>';
}
</script>
</head>
<body>
<h1>Math Practice</h1>
<table id="whole">
<script>
for (i=0; i<5; i++){
document.write("<tr>");
for (j=0; j<5; j++) {
document.write('<td>' + single_problem() + '</td>');
}
document.write('</tr>');
}
</script>
</table>
</body>
</html>