mardi 28 juin 2016

Heavily manipulated html in a javascript var

After getting the HTML code out of a file onto PHP and then Javascript, when I try to display it using:

    <a href='filename.php'>Random link</a>
    <p id='par'>
    </p>
    <script>
      str = "<html>...</html>";
      document.getElementById('par').innerHTML = str;
    </script>

So my question is, how come is Ramdom link displayed with plain html. Shouldn't the html be interpreted ?

Aucun commentaire:

Enregistrer un commentaire