Zitat von tomBuilder
Beitrag anzeigen
Warum sollte das keinen Sinn machen?
<script> window.onload = function() { meinButton.onclick = function() { fetch("tiere.txt") .then(function(response) { return response.text(); }) .then(function(txt) { meinAbsatz.innerHTML = txt;}) }; }; </script>
value | string: Returns / Sets the raw value contained in the control. |
// Lade die txt in ein einfaches array
$myFile = "Tiere.txt";
$lines = file($myFile);//file in to an array
// Erstelle das assoziative Array.
$complexArray = array();
foreach($lines as $line) {
$pair = explode(": ", $line);
$key = $pair[0];
$erklaerung= $pair[1];
$complexArray[$key] = $erklaerung;
};
<form id="dictionary"> <label form="dictionary">Wöterbuch Eingabe </label> <label for="word">Wort: </label> <input type="text" id="word" placeholder="Begriff" value=""> <label for="expalation">Erklärung:</label> <textarea id="explanation" rows="4" cols="50"></textarea> <input type="submit"> </form>
Kommentar