diff --git a/html/calcHypotenuse.html b/html/calcHypotenuse.html new file mode 100644 index 0000000..eb5077b --- /dev/null +++ b/html/calcHypotenuse.html @@ -0,0 +1,24 @@ + + +
+ + + +
+
+
+
+
+
+
+ +
+ + + + \ No newline at end of file diff --git a/html/count.html b/html/count.html new file mode 100644 index 0000000..9dc4cd5 --- /dev/null +++ b/html/count.html @@ -0,0 +1,23 @@ + + + + + + +
+
+
+ + + +
++
+ + + \ No newline at end of file diff --git a/html/counter.html b/html/counter.html new file mode 100644 index 0000000..c3ca919 --- /dev/null +++ b/html/counter.html @@ -0,0 +1,23 @@ + + + + + + +
+
+
+ + + +
++
+ + + \ No newline at end of file diff --git a/html/randomNumberGeneration.html b/html/randomNumberGeneration.html new file mode 100644 index 0000000..d8e43ef --- /dev/null +++ b/html/randomNumberGeneration.html @@ -0,0 +1,21 @@ + + + + + + ++ + + +
++ +
+ + + \ No newline at end of file diff --git a/js/calcHypotenuse.js b/js/calcHypotenuse.js new file mode 100644 index 0000000..7ac841c --- /dev/null +++ b/js/calcHypotenuse.js @@ -0,0 +1,10 @@ +//https://youtu.be/8dWL3wF_OMw?t=2213 +//Calculate hypotenuse on click of Submit-button. +document.getElementById("calcHypotenuseButton").onclick = function() { + let a = document.getElementById("sideAVal").value; + let b = document.getElementById("sideBVal").value; + let c; + + c = Math.sqrt(Math.pow(a,2) + Math.pow(b,2)); + document.getElementById("hypotenuse").innerHTML = "Hypotenuse: " + c; +} \ No newline at end of file diff --git a/js/count.js b/js/count.js new file mode 100644 index 0000000..e9d4ed2 --- /dev/null +++ b/js/count.js @@ -0,0 +1,19 @@ +//Bro codes approach, probably better, since transforming less. + +let count = 0; + +document.getElementById("countDownButton").onclick = function() { + count--; + document.getElementById("counter").innerHTML = count; +} + +document.getElementById("resetButton").onclick = function() { + count = 0; + document.getElementById("counter").innerHTML = count; +} + +document.getElementById("countUpButton").onclick = function() { + let i = Number.parseInt(document.getElementById("counter").innerHTML); + count++; + document.getElementById("counter").innerHTML = count; +} \ No newline at end of file diff --git a/js/counter.js b/js/counter.js new file mode 100644 index 0000000..185410c --- /dev/null +++ b/js/counter.js @@ -0,0 +1,17 @@ +//My approach + +document.getElementById("countDownButton").onclick = function() { + let i = Number.parseInt(document.getElementById("counter").innerHTML); + i--; + document.getElementById("counter").innerHTML = i; +} + +document.getElementById("resetButton").onclick = function() { + document.getElementById("counter").innerHTML = 0; +} + +document.getElementById("countUpButton").onclick = function() { + let i = Number.parseInt(document.getElementById("counter").innerHTML); + i++; + document.getElementById("counter").innerHTML = i; +} \ No newline at end of file diff --git a/js/randomNumberGeneration.js b/js/randomNumberGeneration.js new file mode 100644 index 0000000..3b7a210 --- /dev/null +++ b/js/randomNumberGeneration.js @@ -0,0 +1,8 @@ +//Generates semi random number between 1 and 6. +let a = Math.floor(Math.random() * 6) + 1; + +document.getElementById("roll").onclick = function() { + document.getElementById("xLabel").innerHTML = Math.floor(Math.random() * 6) + 1; + document.getElementById("yLabel").innerHTML = Math.floor(Math.random() * 6) + 1; + document.getElementById("zLabel").innerHTML = Math.floor(Math.random() * 6) + 1; +} \ No newline at end of file