From 037f4d11d59cabfd7a8e4bb2855c4c0dc06a9dcd Mon Sep 17 00:00:00 2001 From: WickedJack99 Date: Wed, 3 Aug 2022 09:10:38 +0200 Subject: [PATCH] 0004 added[hypotenuseCalculator, counter, randomNumberGeneration] --- html/calcHypotenuse.html | 24 ++++++++++++++++++++++++ html/count.html | 23 +++++++++++++++++++++++ html/counter.html | 23 +++++++++++++++++++++++ html/randomNumberGeneration.html | 21 +++++++++++++++++++++ js/calcHypotenuse.js | 10 ++++++++++ js/count.js | 19 +++++++++++++++++++ js/counter.js | 17 +++++++++++++++++ js/randomNumberGeneration.js | 8 ++++++++ 8 files changed, 145 insertions(+) create mode 100644 html/calcHypotenuse.html create mode 100644 html/count.html create mode 100644 html/counter.html create mode 100644 html/randomNumberGeneration.html create mode 100644 js/calcHypotenuse.js create mode 100644 js/count.js create mode 100644 js/counter.js create mode 100644 js/randomNumberGeneration.js 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 @@ + + + + + + + Document + + + +

+
+
+
+
+ +

+

+ +

+

+ + + \ 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 @@ + + + + + + + Document + + + +

+
+

+

+ + + +

+

+

+ + + \ 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 @@ + + + + + + + Document + + + +

+
+

+

+ + + +

+

+

+ + + \ 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 @@ + + + + + + + Document + + + +

+ + + +

+

+ +

+ + + \ 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