-
Notifications
You must be signed in to change notification settings - Fork 0
/
Folio 3.html
65 lines (58 loc) · 2.22 KB
/
Folio 3.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
<!DOCTYPE html>
<html>
<head>
<title>Time Table Generator</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- Uncomment to use external CSS
<link rel="stylesheet" href="PATH/TO/EXTERNAL/STYLES.CSS">
-->
<style type="text/css">
/* Your CSS goes here */
body {
text-align: center;
}
input.placeholder {
text-align: center;
}
</style>
</head>
<body>
<!-- Your HTML goes here -->
<h1>Times Table Generator</h1>
<p>Maximum of up to ten values</p>
<input type="number" id="number" placeholder="Number">
<select id="selection">
<option value="1">1 Time</option>
<option value="2">2 Times</option>
<option value="3">3 Times</option>
<option value="4">4 Times</option>
<option value="5">5 Times</option>
<option value="6">6 Times</option>
<option value="7">7 Times</option>
<option value="8">8 Times</option>
<option value="9">9 Times</option>
<option value="10">10 Times</option>
</select>
<button id="calculate" onclick="calculate()">Calculate</button>
<p>Result</p>
<p id="result"></p>
<!-- Uncomment to use external JavaScript
<script src="PATH/TO/EXTERNAL/SCRIPT.JS"></script>
-->
<script>
/* Your JS goes here */
function calculate (){
var number = parseFloat(document.getElementById("number").value);
var selection = document.getElementById("selection");
var selected = parseInt(selection.options[selection.selectedIndex].value);
var text = "";
var c = 1;
while (c <= selected) {
text += "<br>" + number + " times " + c + " is " + number*c;
c=c+1;
}
document.getElementById("result").innerHTML = text;
}
</script>
</body>
</html>