diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-12-31 20:10:51 +0100 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-12-31 20:10:51 +0100 |
commit | 5acc45bd7aaec2d6e7edd16877e2aa3880fc6f73 (patch) | |
tree | d675f1a9da747cedfb680373f01de2f9053b2f68 | |
download | html-collection-5acc45bd7aaec2d6e7edd16877e2aa3880fc6f73.tar.xz |
Initial commit
-rwxr-xr-x | HTML-Collection.zip | bin | 0 -> 3031 bytes | |||
-rw-r--r-- | README.md | 7 | ||||
-rwxr-xr-x | calculator.html | 56 | ||||
-rwxr-xr-x | colormixer.html | 66 | ||||
-rwxr-xr-x | cookies.html | 47 | ||||
-rwxr-xr-x | guessing.html | 66 | ||||
-rwxr-xr-x | image.png | bin | 0 -> 6824 bytes | |||
-rwxr-xr-x | index.html | 18 |
8 files changed, 260 insertions, 0 deletions
diff --git a/HTML-Collection.zip b/HTML-Collection.zip Binary files differnew file mode 100755 index 0000000..f7cc7cf --- /dev/null +++ b/HTML-Collection.zip diff --git a/README.md b/README.md new file mode 100644 index 0000000..e03bcff --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# HTML-Collection +A collection of HTML pages I made during learning HTML + + + +## Context +I made this a few years ago and it was one of the first pieces of code I wrote, so please be gentle when reading the code. Also, the index.html used to be a PHP file embedded into the elidragon website - when making the repository I renamed it, but otherwise I want to preserve the code. diff --git a/calculator.html b/calculator.html new file mode 100755 index 0000000..230f1b0 --- /dev/null +++ b/calculator.html @@ -0,0 +1,56 @@ +<html> <head> + <meta charset="utf-8"> + <style> + button{width:50px} + input{width:200px;font-family:mono} + #rechnung{} + #ergebnis{} + iframe{background:none;} + </style> + <script> + var result=""; + function addtoterm(charx){ + document.getElementById('rechnung').value+=charx; + } + function reset(){ + document.getElementById('rechnung').value=""; + document.getElementById('ergebnis').value=""; + } + function deletec(){ + var oldn=document.getElementById('rechnung').value; + var newn=oldn.slice(0,oldn.length-1); + document.getElementById('rechnung').value=newn; + } + function calculate(){ + var term=document.getElementById('rechnung').value; + term=term.replace(/x/,'*'); + term=term.replace(/:/,'/'); + result=eval(term); + if(result===NaN){ + result="Mathematisch Inkorrekt"; + document.getElementById('ergebnis').value=result; + result=""; + } + else if(result===undefined){ + result="Nicht Definiert"; + document.getElementById('ergebnis').value=result; + result=""; + } + else{ + document.getElementById('ergebnis').value=result; + } + } + </script> + </head> + <body> + + <input type="text"readonly id="rechnung"><br> + <input type="text"readonly id="ergebnis"><br> + <button onclick="addtoterm(1)">1</button><button onclick="addtoterm(2)">2</button><button onclick="addtoterm(3)">3</button><button onclick='addtoterm(":")'>:</button><br> + <button onclick="addtoterm(4)">4</button><button onclick="addtoterm(5)">5</button><button onclick="addtoterm(6)">6</button><button onclick='addtoterm("x")'>x</button><br> + <button onclick="addtoterm(7)">7</button><button onclick="addtoterm(8)">8</button><button onclick="addtoterm(9)">9</button><button onclick='addtoterm("-")'>-</button><br> + <button onclick="addtoterm(0)">0</button><button onclick='addtoterm("(")'>(</button><button onclick='addtoterm(")")'>)</button><button onclick='addtoterm("+")'>+</button><br> + <button onclick="deletec()">del</button><button onclick="reset()">AC</button><button onclick="addtoterm(result)">Ans</button><button onclick="calculate()">=</button><br> + + </body> +</html> diff --git a/colormixer.html b/colormixer.html new file mode 100755 index 0000000..665b76b --- /dev/null +++ b/colormixer.html @@ -0,0 +1,66 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>COLOR-Mixer</title> + <script type="text/javascript"> + window.addEventListener("DOMContentLoaded",reset); + window.addEventListener("DOMContentLoaded",hide); + window.addEventListener("input",calculate); + + function calculate(){ + var r=document.getElementsByTagName('input')[0].value*256/100; + var g=document.getElementsByTagName('input')[1].value*256/100; + var b=document.getElementsByTagName('input')[2].value*256/100; + var a=document.getElementsByTagName('input')[3].value*1/100; + document.getElementById('out').style.background="rgba("+r+","+g+","+b+","+a+")"; + var darkness=1-document.getElementsByTagName('input')[4].value*1/100; + document.getElementById('hide').style.opacity=darkness; + } + function reset(){ + document.getElementsByTagName('input')[0].value=50; + document.getElementsByTagName('input')[1].value=50; + document.getElementsByTagName('input')[2].value=50; + document.getElementsByTagName('input')[3].value=50; + document.getElementsByTagName('input')[4].value=50; + calculate(); + + } + function save(){ + document.cookie=document.getElementsByName('out')[0].style.backgroundColor; + } + function load(){ + if(document.cookie){ + document.getElementById('out').style.backgroundColor=document.cookie; + } + else{ + window.alert("Keine Farbe Abgespeichert!"); + } + + } + function hide(){ + document.getElementById('hide').style.left=document.getElementById('out').style.left; + document.getElementById('hide').style.top=document.getElementById('out').style.top; + + } + </script> + <style> + input{position:absolute;left:140px} + </style> + </head> + <body> + <div style="background:red;width:130px;position:absolute;left:10px"><center>RED</center></div><input type="range" ><br> + <div style="background:green;width:130px;position:absolute;left:10px"><center>GREEN</center></div><input type="range"><br> + <div style="background:blue;width:130px;position:absolute;left:10px"><center>BLUE</center></div><input type="range"><br> + <div style="background:white;width:130px;position:absolute;left:10px"><center>SATURATION</center></div><input type="range"><br> + <div style="background:white;width:130px;position:absolute;left:10px"><center>BRIGHTNESS</center></div><input type="range"><br><br> + + <!-- <button onclick="reset();calculate()">FARBE ZURÜCKSETZTEN</button><button onclick="save()">FARBE SPEICHERN</button><button onclick="load()">FARBE LADEN</button><br><br>--> + <div id="hide"style="width:150px;height:150px;position:absolute;background-color:black"></div> + <div id="out"style="width:150px;height:150px;top:150px;left:10px;position:absolute"></div> + + + + + </body> +</html> diff --git a/cookies.html b/cookies.html new file mode 100755 index 0000000..a7d18b4 --- /dev/null +++ b/cookies.html @@ -0,0 +1,47 @@ +<html> +<head> +<meta charset="utf-8"> +<title>Cookies</title> +<script> +var text=""; +function init() { + if(document.cookie){ +text=document.cookie.split(','); +document.getElementsByName('ein')[0].value=""; +document.getElementsByName('ein')[1].value=""; +if(window.prompt("Password:")===text[1]){ +ausgabe(text[0]); +} +else{ + window.alert("Wrong. Resetting Cookie."); + document.cookie = ""; + ausgabe("none"); + } +} +} +function eingabe(){ +document.cookie=[document.getElementsByName('ein')[0].value,document.getElementsByName('ein')[1].value]; + } +function ausgabe(text) { + var ausgabe = document.getElementsByName('anzeige')[0]; + ausgabe.innerHTML = text; +} + +window.addEventListener('DOMContentLoaded', init); +</script> +</head> +<body> +<h1>Use a cookie to save data.</h1> +Content Last Time: +<p name="anzeige"></p> +<br><br> +Content: +<br> +<textarea name="ein"></textarea> +<br> +Password: +<br> +<input name="ein"> +<button onclick="eingabe();">Save</button><br> +</body> +</html> diff --git a/guessing.html b/guessing.html new file mode 100755 index 0000000..fbd9bbb --- /dev/null +++ b/guessing.html @@ -0,0 +1,66 @@ +<html><head> + <meta charset="utf-8"> + <style type="text/css"> + body { background-color:lightyellow; } + div { width:15em; height: 6em; padding:1em;margin:1em;background-color:lightgreen; text-align:center;} + div.blauer {background-color:lightblue;} + </style> + <script> + + var a = []; + var t = []; + var b=[1,2,3,4,5]; + setTimeout(setzen,100); + function setzen(){ + document.getElementById('punkte').value=0; + a=[3,2,5,1,4]; + document.getElementById('b1').innerHTML=a[0]; + document.getElementById('b2').innerHTML=a[1]; + document.getElementById('b3').innerHTML=a[2]; + document.getElementById('b4').innerHTML=a[3]; + document.getElementById('b5').innerHTML=a[4]; + } + function controll(){ + document.getElementById('b1').innerHTML=a[0]; + document.getElementById('b2').innerHTML=a[1]; + document.getElementById('b3').innerHTML=a[2]; + document.getElementById('b4').innerHTML=a[3]; + document.getElementById('b5').innerHTML=a[4]; + + + if(a.join() == b.join()){ + window.alert("DONE! Bad Points: "+document.getElementById('punkte').value); + location.reload(); + } + } + function change(number){ + for(i=0;i < number;i++){ + t.push(a.shift()); + } + for(i=0;i < number;i++){ + a.unshift(t.shift()); + } + var c = parseInt(document.getElementById('punkte').value); + document.getElementById('punkte').value = c + 1; + controll(); + } +</script> +</head> +<body> + <h1>Guessing Game</h1> + <p>Switch the nubers till they are in the correct order!</p> + <div style="background-color:pink"> + <button id="b1" onclick="change(1)"></button> + <button id="b2" onclick="change(2)"></button> + <button id="b3"onclick="change(3)"></button> + <button id="b4"onclick="change(4)"></button> + <button id="b5"onclick="change(5)"></button> + </div> + <div> + <h3>BAD POINTS</h3> + <input type="number"readonly id="punkte" value="0" /> + </div> +</body> + +</html> + diff --git a/image.png b/image.png Binary files differnew file mode 100755 index 0000000..53e159d --- /dev/null +++ b/image.png diff --git a/index.html b/index.html new file mode 100755 index 0000000..6f9e420 --- /dev/null +++ b/index.html @@ -0,0 +1,18 @@ +<?php +require("/var/www/common.php") +?> + <meta charset="utf-8"> + <title>HTML Collection</title> +<div class="elidragon box"> + <div class="nice"> + <h1>HTML Collection</h1> + <h2><a href="HTML-Collection.zip" download>Download Zip</a></h2> + <h2>Contents</h2> + <ul class="elidragon text"> + <li><a href="colormixer.html">Colormixer</a></li> + <li><a href="calculator.html">Calculator</a></li> + <li><a href="cookies.html">Cookie Demo</a></li> + <li><a href="guessing.html">Guessing Game</a></li> + </ul> + </div> +</div>
\ No newline at end of file |