diff --git a/JavaScript/Beispiele/02.html b/JavaScript/Beispiele/02.html index 78dc2f6..9741c3a 100644 --- a/JavaScript/Beispiele/02.html +++ b/JavaScript/Beispiele/02.html @@ -13,38 +13,17 @@

-

+
+ +

+

- + \ No newline at end of file diff --git a/JavaScript/Beispiele/03.html b/JavaScript/Beispiele/03.html new file mode 100644 index 0000000..b0d1f36 --- /dev/null +++ b/JavaScript/Beispiele/03.html @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/JavaScript/Beispiele/assets/css/02.css b/JavaScript/Beispiele/assets/css/02.css index d239232..ad96907 100644 --- a/JavaScript/Beispiele/assets/css/02.css +++ b/JavaScript/Beispiele/assets/css/02.css @@ -10,7 +10,7 @@ body { border-radius: 8px; background-color: #f9f9f9; } -input[type="text"], input[type="password"] { +input[type="text"] { width: 100%; padding: 10px; margin: 8px 0; @@ -19,6 +19,8 @@ input[type="text"], input[type="password"] { border-radius: 4px; box-sizing: border-box; } + + button { width: 100%; padding: 10px; @@ -31,4 +33,26 @@ button { } button:hover { background-color: #45a049; +} + +input[type="password"].passField { + width: calc(100% - 40px); + padding: 10px; + margin: 8px 0; + display: inline-block; + border: 1px solid #ccc; + border-radius: 4px; + box-sizing: border-box; +} + +button.icon { + width: 30px; + padding: 9px; + margin: 0px; + background-color: #4CAF50; + color: white; + border: none; + border-radius: 4px; + cursor: pointer; + } \ No newline at end of file diff --git a/JavaScript/Beispiele/assets/js/scripts.js b/JavaScript/Beispiele/assets/js/scripts.js new file mode 100644 index 0000000..ba7c55a --- /dev/null +++ b/JavaScript/Beispiele/assets/js/scripts.js @@ -0,0 +1,23 @@ +function togglePassword(){ + var passwordField = document.getElementById("togglePasswordBtn"); + + if(passwordField.type === 'password'){ + passwordField.type = 'text'; + } + else if(passwordField.type === 'text'){ + passwordField.type = 'password'; + } + } + + + + document.getElementById('togglePasswordBtn2').addEventListener('click', function() { + var passwordField2 = document.getElementById("togglePasswordBtn"); + + if(passwordField2.type === 'password'){ + passwordField2.type = 'text'; + } + else if(passwordField2.type === 'text'){ + passwordField2.type = 'password'; + } + }); \ No newline at end of file diff --git a/JavaScript/assets/css/style.css b/JavaScript/assets/css/style.css index 603d627..2073670 100644 --- a/JavaScript/assets/css/style.css +++ b/JavaScript/assets/css/style.css @@ -15,11 +15,39 @@ input{ .webBox{ - text-align: center; + display: flex; + justify-content: center; + align-items: center; } -.boxText{ - display:block; - float:left; - padding:5px 10px +.btnBG{ + color: red; +} + +@media screen and (max-width: 600px) { + + button { + width: 100%; + padding: 10px; + margin: 8px ; + background-color: #4CAF50;; + color: white; + border: none; + border-radius: 4px; + cursor: pointer; + } + + button.btnColor { + width: 100%; + padding: 10px; + margin: 8px ; + background-color: #4CAF50;; + color: red; + border: none; + border-radius: 4px; + cursor: pointer; + } + + + } \ No newline at end of file diff --git a/JavaScript/assets/js/manipulation.js b/JavaScript/assets/js/manipulation.js index f82ef94..96257ec 100644 --- a/JavaScript/assets/js/manipulation.js +++ b/JavaScript/assets/js/manipulation.js @@ -1,19 +1,19 @@ function setSize(varWidth, varHeight){ - var box = document.getElementById("webBoxSel"); - var boxHeight = (varHeight / 2); - var boxwidth = (varWidth / 2); + let box = document.getElementById("webBoxSel"); + let boxHeight = (varHeight / 2); + let boxWidth = (varWidth / 2); - if(boxHeight >= 300) + if((boxHeight >= 300) && (boxWidth >= 300)) { box.style.backgroundColor = 'red'; }else{ box.style.backgroundColor = 'yellow'; } - box.style.width = boxwidth+'px'; + box.style.width = boxWidth+'px'; box.style.height = boxHeight+'px'; - var textInBox = document.getElementById("boxText"); + let textInBox = document.getElementsByClassName('boxTextClass')[0]; textInBox.style.color = 'blue'; textInBox.style.margin = '25%'; @@ -32,5 +32,130 @@ window.addEventListener("resize", function (){ const varW = window.outerWidth; const varH = window.outerHeight; setSize(varW, varH); -}) +}); +document.getElementById("textValueBtn").addEventListener('click', function(){ + let textInBox = document.getElementById("boxTextID"); + let changeText = document.getElementById("textValue").value; + + + if(changeText.length == 0) + { + alert("Text: Not a valid text for this action.") + }else{ + textInBox.innerText = changeText; + } +}); + +document.getElementById("textSizeBtn").addEventListener('click', function(){ + let textInBox = document.getElementById("boxTextID"); + let changeSize = document.getElementById("textSize").value; + + if(!isNaN(changeSize)) + { + alert("Size: Not a valid number for this action.") + }else{ + textInBox.style.fontSize = changeSize+"px"; + } +}); + +document.getElementById("textAngleBtn").addEventListener('click', function(){ + let textInBox = document.getElementById("boxTextID"); + let changeAngle = document.getElementById("textAngle").value; + + if(!isNaN(changeAngle)) + { + alert("Angle: Not a valid number for this action.") + }else{ + textInBox.style.transform = "rotate("+changeAngle+"deg)"; + } +}); + + +document.getElementById("startBinCalc").addEventListener('click', function(){ + let dezNumberToBin1 = tryParseInt(document.getElementById("binValue1").value); + let dezNumberToBin2 = tryParseInt(document.getElementById("binValue2").value); + + if(isNaN(dezNumberToBin1) || isNaN(dezNumberToBin2)) + { + alert("BinaryNumberAddition: At least one number is not valid for this action.") + }else{ + let bin1 = calcDezToBin(dezNumberToBin1); + let bin2 = calcDezToBin(dezNumberToBin2); + + additionTwoBinNumbers(bin1, bin2); + + + document.getElementById('binCalcResult').innerText = bin1 + " - " + bin2; + } +}); + +function calcDezToBin(dezNumber){ + + let tempNumber = dezNumber; + let remainderString = ""; + + let lastNumber = 0; + + while(tempNumber != 0) + { + lastNumber = Math.floor(tempNumber/2); + remainderString += tempNumber%2; + tempNumber = lastNumber; + } + + let binaryValue = flipBinString(remainderString); + return binaryValue; + //document.getElementById('binCalcResult').innerText = binaryValue; +} + +function tryParseInt(str) { + let retValue = null; + if(str !== null) { + if(str.length > 0) { + if (!isNaN(str)) { + retValue = parseInt(str); + return retValue; + } + } + } + return str; +} + +function flipBinString(remainderString) +{ + let count = remainderString.length; + let remainders = [count]; + + for(i = 0; i < count; i++) + { + remainders[i] = remainderString[i]; + } + let returnVal = remainders.reverse().join(''); + return returnVal; +} + +function additionTwoBinNumbers(bin1, bin2) +{ + let bin1Array = bin1.split(""); + let bin2Array = bin2.split(""); + let tempResult = ""; + + if(bin1Array.length < bin2Array.length) + for(i = 0; i < bin2Array.length; i++) + { + + + + + } + else + for(i = 0; i < bin1Array.length; i++) + { + + + } + + + +} \ No newline at end of file diff --git a/JavaScript/index.html b/JavaScript/index.html index ea7f7a9..8c4a788 100644 --- a/JavaScript/index.html +++ b/JavaScript/index.html @@ -15,35 +15,51 @@
Text - - + +
Schriftgröße - + px - +
Drechung - + ° - +
- +

- Das ist nur ein BeipielText + Das ist nur ein Beipieltext der geändert wird.
+ +



+ +
+ Dezimalzahl1: + + + Dezimalzahl2: + + + +
+
+ asd +
+