-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
74 lines (64 loc) · 2.88 KB
/
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Calculator</title>
<style>
/* CSS for changing font */
body {
font-family: Helvetica, sans-serif;
}
#additionalInfo {
font-family: Helvetica, sans-serif;
font-style: italic; /* Set font style to italic */
}
/* CSS for result text color */
#result {
color: blue; /* Change color to blue */
font-size: 24px; /* Change font size to 24 pixels */
}
</style>
<script>
// JavaScript code for performing calculations
function calculate() {
// Get input values
var num1 = parseFloat(document.getElementById("num1").value);
var num2 = parseFloat(document.getElementById("num2").value);
var num3 = parseFloat(document.getElementById("num3").value);
var num4 = parseFloat(document.getElementById("num4").value);
// Perform calculation
var result = ((((num1 * num2) / num3) * num4) / 50);
// Reduce the number of decimal places to 2
var formattedResult = result.toFixed(2);
// Display result
document.getElementById("result").innerHTML = "SABU: " + formattedResult;
}
// Function to reset the calculator
function resetCalculator() {
document.getElementById("num1").value = "";
document.getElementById("num2").value = "";
document.getElementById("num3").value = "";
document.getElementById("num4").value = "";
document.getElementById("result").innerHTML = "";
}
</script>
</head>
<body>
<h1>Standard Adult Beanie Unit (SABU)</h1>
<label for="num1">Number of balls required:</label>
<input type="number" id="num1"><br><br>
<label for="num2">Meterage per ball (m):</label>
<input type="number" id="num2"><br><br>
<label for="num3">Needle size (mm):</label>
<input type="number" id="num3"><br><br>
<label for="num4">Complexity factor*:</label>
<input type="number" id="num4"><br><br>
<button onclick="calculate()">Calculate</button>
<button onclick="resetCalculator()">Reset</button><br><br>
<div id="result"></div>
<div id="additionalInfo">
<p><br><br>*This is completely variable and up to you and is person and project dependent.<br>My personal complexity factors are:<br>1.0 - All knit (i.e. stockinette in the round or garter flat)<br>1.2 - Knit 1 row, purl 1 row (i.e. flat stockinette)<br>1.3 - Textured knits (using knit and purl sts)<br>1.6 - Densely cabled knits<br>2.0 - All over colorwork.<br><br>Written and developed by Sarah I. Garry, intended for personal use only. Get in touch with me at [email protected]</p>
</div>
</body>
</html>