diff --git a/Zweites Jahr/javascript/htmlformular/htmlformular.html b/Zweites Jahr/javascript/htmlformular/htmlformular.html new file mode 100644 index 0000000..782c046 --- /dev/null +++ b/Zweites Jahr/javascript/htmlformular/htmlformular.html @@ -0,0 +1,24 @@ + + + + + + + Document + + +
+
+ + +
+ +
+ + +

+
+
+ + + \ No newline at end of file diff --git a/Zweites Jahr/javascript/htmlformular/htmlformular_files/script.js b/Zweites Jahr/javascript/htmlformular/htmlformular_files/script.js new file mode 100644 index 0000000..ba78b30 --- /dev/null +++ b/Zweites Jahr/javascript/htmlformular/htmlformular_files/script.js @@ -0,0 +1,30 @@ +const x =5;//const ist eine permanente Variable die nicht verändert werden kann +let y = 4;//mit let definieren wir Variablen die noch verändert werden können + +//alert wird jedesmal ausgegeben wenn javascript geladen wurde +alert("JAVASCRIPT FUNKTIONIERT"); + + +const feld1 = document.getElementById("name"); +feld1.addEventListener("input", function(){ + if(feld1.value.length > 4){ + feld1.style.backgroundColor="green"; + } + else{ + feld1.style.backgroundColor="red"; + } + +}) + +function laenge(){ + const feld2 = document.getElementById("adresse"); +// feld2.innerHTML="not long enaugh"; + feld2.addEventListener("input", function(){ + if(feld2.value.length > 4){ + feld2.style.backgroundColor="green"; + } + else{ + feld2.style.backgroundColor="red"; + } +} +)} \ No newline at end of file