erstellung textanalyse + .js datei
This commit is contained in:
parent
dd27caa1b5
commit
1d943bdda7
2 changed files with 51 additions and 0 deletions
19
js/textanalyse.js
Normal file
19
js/textanalyse.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
function analyseText(text) {
|
||||
let zeichen = text.length;
|
||||
let woerter = text.split(" ").length;
|
||||
let grossbuchstaben = text.toUpperCase();
|
||||
|
||||
return `Zeichen: ${zeichen}
|
||||
Wörter: ${woerter}
|
||||
Großbuchstaben: ${grossbuchstaben}`;
|
||||
}
|
||||
|
||||
let text = prompt("Gib einen Text ein:");
|
||||
|
||||
if (text === "" || text === null) {
|
||||
alert("Fehler: Du hast keinen Text eingegeben!");
|
||||
} else {
|
||||
let ergebnis = analyseText(text);
|
||||
alert(ergebnis);
|
||||
}
|
||||
|
||||
32
textanalyse.html
Normal file
32
textanalyse.html
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Textanalyse</title>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Barlow:wght@300;400;500&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<span class="logo">Glück Auf</span>
|
||||
<ul>
|
||||
<li><a href="index.html">Start</a></li>
|
||||
<li><a href="ueber_mich.html">Über mich</a></li>
|
||||
<li><a href="eis_projekt.html">Projekt</a></li>
|
||||
<li><a href="notenrechner.html">Notenrechner</a></li>
|
||||
<li><a href="textanalyse.html" class="active">Textanalyse</a></li>
|
||||
<li><a href="kontakt.html">Kontakt</a></li>
|
||||
<li><a href="impressum.html">Impressum</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="page">
|
||||
<p class="tag">Übung</p>
|
||||
<h1>Textanalyse</h1>
|
||||
<p class="sub">Analysiere deinen Text auf Knopfdruck.</p>
|
||||
</div>
|
||||
|
||||
<script src="js/textanalyse.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in a new issue