SyntaxSection

by padma rubhan

HTML

<!-- Learn about this code on MDN: https://developer.mozilla.org/en-US/docs/Web/API/Document/write -->

<html>

<head>
  <title>write example</title>

  <script>
    function newContent() {
      document.open();
      document.write("<h1>Out with the old - in with the new!</h1>");
      document.close();
    }
  </script>
</head>

<body onload="newContent();">
  <p>Some original document content.</p>
</body>

</html>

JavaScript

//document.write(markup);