From 874248380a06e4c9d6fab75437bb16878add827c Mon Sep 17 00:00:00 2001 From: Kilokem Date: Thu, 19 Sep 2024 16:17:20 +0200 Subject: [PATCH] BasicsAreDone_MistakesWereMade! --- Basics/index.html | 65 +++++++++++++++++++++++++++++++++++++ Basics/script.js | 82 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 147 insertions(+) create mode 100644 Basics/index.html create mode 100644 Basics/script.js diff --git a/Basics/index.html b/Basics/index.html new file mode 100644 index 0000000..c61a5bf --- /dev/null +++ b/Basics/index.html @@ -0,0 +1,65 @@ + + + + + + Sh*t + + +
+ +
+
+

Welcome!

+ +
+
+

Output shall be here!!!

+
+
+

a + b

+ + + + +
+

Output shall be here!!!

+ +
+
+

Circumference of a circle!

+ + +
+

Output shall be here!!!

+
+ +
+

Counter:

+
+ + + +
+
+

MATH!!!!

+ + + + + + + +
+
+
+

RANDOMISE

+ + + +
+
+ + + + \ No newline at end of file diff --git a/Basics/script.js b/Basics/script.js new file mode 100644 index 0000000..4b3b7cb --- /dev/null +++ b/Basics/script.js @@ -0,0 +1,82 @@ +document.addEventListener("DOMContentLoaded", function() { + const PI = 3.14; + let y = 10, x = 5; + + x = 100; + + console.log(x); + + document.getElementById("allertask").onclick = function(){ + let username = window.prompt("Whats your name?"); + console.log(username); + }; + + document.getElementById("submit").onclick = function(){ //simple input output + let text = document.getElementById("mytext").value; + console.log(text); + document.getElementById("welc").textContent = `Helllo ${text}`; + }; + + document.getElementById("numcalc").onclick = function(){ //Data conversion + let a = document.getElementById("numa").value; + let b = document.getElementById("numb").value; + document.getElementById("calcout").textContent = Number(a) + Number(b) +" Type of input: "+ typeof(a) + " Type of converion: " + typeof(Number(a)); + //Other conversons: + String(a); + Boolean(a); //When empty string is given it will turn false every other case it will be true + Number(a); + } + + + document.getElementById("circumcal").onclick = function(){ //Just for constant Values + document.getElementById("circumcalout").textContent = "The circumference of a circle is: " + 2 * PI * Number(document.getElementById("numrad").value) + "cm"; + }; + + + document.getElementById("countdecrease").onclick = function(){ //Counter thingy + document.getElementById("counterlab").textContent = Number(document.getElementById("counterlab").textContent) - 1; + }; + document.getElementById("countincrease").onclick = function(){ + document.getElementById("counterlab").textContent = Number(document.getElementById("counterlab").textContent) + 1; + }; + document.getElementById("countreset").onclick = function(){ + document.getElementById("counterlab").textContent = 0; + } + + + document.getElementById("gimmeapie").onclick = function(){ //Most of the math I'll need! + document.getElementById("mathouput").textContent = Math.PI; + }; + document.getElementById("mathefloor").onclick = function(){ + document.getElementById("mathouput").textContent = Math.floor(Math.PI); + }; + document.getElementById("matheceil").onclick = function(){ + document.getElementById("mathouput").textContent = Math.ceil(Math.PI); + }; + document.getElementById("mathetrunc").onclick = function(){ + document.getElementById("mathouput").textContent = Math.trunc(Math.PI); + }; + document.getElementById("mathepower").onclick = function(){ + document.getElementById("mathouput").textContent = Math.pow(Math.PI, 2); + }; + document.getElementById("matheroot").onclick = function(){ + document.getElementById("mathouput").textContent = Math.sqrt(Math.PI); + }; + document.getElementById("mathelog").onclick = function(){ + document.getElementById("mathouput").textContent = Math.log(Math.PI); + }; + + + document.getElementById("gimerandom").onclick = function(){ + document.getElementById("randomoutput").textContent = Math.random(); + }; + document.getElementById("rollthedice").onclick = function(){ + document.getElementById("randomoutput").textContent = Math.trunc(Math.random()*6) + 1; + }; + document.getElementById("biggerrandom").onclick = function(){ + let max = 100, min = 50; + document.getElementById("randomoutput").textContent = Math.trunc(Math.random()*(max-min)) + min; + }; + + +});