Textanalyse hinzugefügt

This commit is contained in:
Carina_Hirschle 2026-05-29 17:22:04 +02:00
parent 8ec1c1137f
commit 7e38d4a872
4 changed files with 81 additions and 1 deletions

View file

@ -242,3 +242,18 @@ footer {
color: #003366; color: #003366;
margin: 0; margin: 0;
} }
/* 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;
}

View file

@ -8,6 +8,7 @@ const navigation = `
<a href="eis_projekt.html">Projekt</a> <a href="eis_projekt.html">Projekt</a>
<a href="team.html">Steckbrief</a> <a href="team.html">Steckbrief</a>
<a href="notenrechner.html">Notenrechner</a> <a href="notenrechner.html">Notenrechner</a>
<a href="textanalyse.html">Textanalyse</a>
<a href="kontakt.html">Kontakt</a> <a href="kontakt.html">Kontakt</a>
<a href="impressum.html">Impressum</a> <a href="impressum.html">Impressum</a>
</nav> </nav>

View file

@ -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 =
`<strong>Zeichen:</strong> ${text.length}<br>
<strong>Wörter:</strong> ${text.trim().split(/\s+/).length}<br>
<strong>Großbuchstaben:</strong> ${text.toUpperCase()}`;
document.getElementById("ergebnis").style.display = "block";
}

View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Textanalyse Cyanotypie</title>
<link rel="stylesheet" href="css/style.css">
<link rel="icon" href="img/Favicon.jpg" type="image/jpeg">
</head>
<body>
<script src="js/nav.js"></script>
<main>
<h1>Textanalyse</h1>
<p>Gib einen Text ein und analysiere ihn.</p>
<div class="rechner-box">
<div class="rechner-feld">
<label for="eingabe">Dein Text</label>
<textarea id="eingabe" rows="5" placeholder="Text hier eingeben..."></textarea>
</div>
<button class="btn" onclick="starten()">Text analysieren</button>
</div>
<div class="ergebnis-box" id="ergebnis" style="display:none;">
<p id="ergebnisText"></p>
</div>
</main>
<footer>
<p>&copy; 2026 Lernprojekt EIS</p>
</footer>
<script src="js/textanalyse.js"></script>
</body>
</html>