diff --git a/css/style.css b/css/style.css index 26cc4ce..07143f7 100644 --- a/css/style.css +++ b/css/style.css @@ -241,4 +241,19 @@ footer { font-weight: 600; color: #003366; margin: 0; -} \ No newline at end of file +} + +/* Textarea */ +.rechner-feld textarea { + padding: 10px 14px; + border: 1px solid #e2e8f0; + border-radius: 6px; + font-size: 1rem; + font-family: inherit; + resize: vertical; + outline: none; +} + +.rechner-feld textarea:focus { + border-color: #2563eb; +} diff --git a/js/nav.js b/js/nav.js index abf04df..cdf3439 100644 --- a/js/nav.js +++ b/js/nav.js @@ -8,6 +8,7 @@ const navigation = ` Projekt Steckbrief Notenrechner + Textanalyse Kontakt Impressum diff --git a/js/textanalyse.js b/js/textanalyse.js index e69de29..ad6ac83 100644 --- a/js/textanalyse.js +++ b/js/textanalyse.js @@ -0,0 +1,28 @@ +function analyseText(text) { + const zeichen = text.length; + const woerter = text.trim().split(/\s+/).length; + const grossbuchstaben = text.toUpperCase(); + + return `Zeichen: ${zeichen}\nWörter: ${woerter}\nGroßbuchstaben: ${grossbuchstaben}`; +} + +function starten() { + const text = document.getElementById("eingabe").value; + + if (text.trim() === "") { + alert("Bitte gib einen Text ein!"); + return; + } + + const ergebnis = analyseText(text); + + console.log(ergebnis); + alert(ergebnis); + + document.getElementById("ergebnisText").innerHTML = + `Zeichen: ${text.length}
+ Wörter: ${text.trim().split(/\s+/).length}
+ Großbuchstaben: ${text.toUpperCase()}`; + + document.getElementById("ergebnis").style.display = "block"; +} \ No newline at end of file diff --git a/textanalyse.html b/textanalyse.html index e69de29..1a8851d 100644 --- a/textanalyse.html +++ b/textanalyse.html @@ -0,0 +1,36 @@ + + + + + + Textanalyse – Cyanotypie + + + + + + +
+

Textanalyse

+

Gib einen Text ein und analysiere ihn.

+ +
+
+ + +
+ +
+ + +
+ + + + + + \ No newline at end of file