< >

gegenversuch.php


Quell Code


<style>
  #inhalt,body,#inhalt2{
  color:red;
    font-family: 'Dosis';
}
h2{
color:black;
}
</style>

<h1 style="text-decoration: underline; color: rgb(36, 125, 160);">Überschift</h1>
<p1>Unter mir soll .txt-Datei <a href="test.txt">Test.txt</a>&nbsp;, mit der Schriftart 'Dosis' eingebunden werden.</p1>

<div id="inhalt"></div>
    <script>
        window.onload = function () {
        div=document.getElementById('inhalt');
        var linksrc = "txt/index.php?txt&name=txt-laden-test.txt";

        let xhr = new XMLHttpRequest ();
        xhr.onreadystatechange = function () {
            if (this.readyState === 4 && this.status === 200) {
            let response = this.responseText;
            div.innerHTML+=response;
            div.style.color='red';
            }
        }
        xhr.open ("GET", linksrc);
        xhr.send ();
        }
        </script>
        <h2>Hier mit php readfile() </h2>
        <div id="inhalt2"><iframe src="txt/index.php?txt&name=txt-laden-test.txt"></iframe>