BasicsAreDone_MistakesWereMade!
This commit is contained in:
65
Basics/index.html
Normal file
65
Basics/index.html
Normal file
@ -0,0 +1,65 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Sh*t</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<input type="button" id="allertask" value="AllertAsk, Then Console Repeare">
|
||||
</div>
|
||||
<div>
|
||||
<h1>Welcome!</h1>
|
||||
<label for="" id="">Username</label>
|
||||
<input type="text" name="mytext" id="mytext"><br>
|
||||
<input type="button" id="submit" value="submit"><br>
|
||||
<p id="welc">Output shall be here!!!</p>
|
||||
</div>
|
||||
<div>
|
||||
<h1>a + b</h1>
|
||||
<label for="numa">Value a: </label>
|
||||
<input type="text" name="" id="numa">
|
||||
<label for="numb">Value b: </label>
|
||||
<input type="text" name="" id="numb">
|
||||
<input type="button" id="numcalc" value="submit"><br>
|
||||
<p id="calcout">Output shall be here!!!</p>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<h1>Circumference of a circle!</h1>
|
||||
<label for="numrad">radius (cm): </label>
|
||||
<input type="text" name="" id="numrad">
|
||||
<input type="button" id="circumcal" value="submit"><br>
|
||||
<p id="circumcalout">Output shall be here!!!</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h1>Counter:</h1>
|
||||
<label for="" id="counterlab" style="font-size: 5em;">0</label><br>
|
||||
<input type="button" id="countdecrease" value="-----">
|
||||
<input type="button" id="countreset" value="RESET">
|
||||
<input type="button" id="countincrease" value="+++++">
|
||||
</div>
|
||||
<div>
|
||||
<h1>MATH!!!!</h1>
|
||||
<input type="button" id="gimmeapie" value="GIMME PIEEE">
|
||||
<input type="button" id="mathefloor" value="Floor PIE">
|
||||
<input type="button" id="matheceil" value="Ceil PIE">
|
||||
<input type="button" id="mathetrunc" value="Trunc PIE">
|
||||
<input type="button" id="mathepower" value="Power of 2 PIE">
|
||||
<input type="button" id="matheroot" value="Square root of 2 PIE">
|
||||
<input type="button" id="mathelog" value="Log PIE">
|
||||
<br><label id="mathouput"></label>
|
||||
</div>
|
||||
<div>
|
||||
<h1>RANDOMISE</h1>
|
||||
<input type="button" id="gimerandom" value="RANDOMISE!">
|
||||
<input type="button" id="rollthedice" value="DICE!">
|
||||
<input type="button" id="biggerrandom" value="BIGER random!!">
|
||||
<br><label id="randomoutput"></label>
|
||||
</div>
|
||||
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
82
Basics/script.js
Normal file
82
Basics/script.js
Normal file
@ -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;
|
||||
};
|
||||
|
||||
|
||||
});
|
Reference in New Issue
Block a user